Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

cannot log google ads logging v19 python client

Đang mở
#557 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện ví dụ Python 3.12.9 được cung cấp với google-ads 26.1.0, tập trung vào logging.basicConfig và google.ads.googleads.client. So sánh hành vi ghi log khi dịch vụ được yêu cầu với v17 so với v19; hoàn tất khi v19 tạo ra các log Google Ads như mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hi Google Ads team,

Since upgrading Google Ads API version to v19, I cannot get the Google Ads logging.

import asyncio
import logging
from google.protobuf.json_format import MessageToDict

logging.basicConfig(level=logging.INFO, format='[%(asctime)s - %(levelname)s] %(message).5000s')
logging.getLogger('google.ads.googleads.client').setLevel(logging.INFO)

import google.ads.googleads.client


def setup_google_ads_connection():
    google_ads_client = (
        google.ads.googleads.client.GoogleAdsClient.load_from_storage("googleads.yaml")
    )
    ga_service = google_ads_client.get_service("GoogleAdsService", version="v19")
    return google_ads_client, ga_service


async def main(google_ads_client, google_ads_service):
    cust_list = ["2978713003"]
    for cust_id in cust_list:
        asset_query = "SELECT segments.date,[campaign.id](http://campaign.id/),[ad_group.id](http://ad_group.id/),metrics.impressions,metrics.clicks,metrics.cost_micros,asset_field_type_view.field_type,metrics.video_views,metrics.cross_device_conversions FROM asset_field_type_view  WHERE segments.date >= '2025-03-05' AND segments.date <= '2025-03-05' AND metrics.impressions > 0 AND [campaign.id](http://campaign.id/) in ('21080449403')"
        setting = google_ads_client.get_type('SummaryRowSettingEnum').SummaryRowSetting.SUMMARY_ROW_WITH_RESULTS
        search_request = google_ads_client.get_type("SearchGoogleAdsStreamRequest")
        search_request.customer_id = cust_id
        search_request.query = asset_query
        search_request.summary_row_setting = setting
        _CLIENT_TIMEOUT_SECONDS = 400
        
        stream = google_ads_service.search_stream(
            search_request, 
            timeout=_CLIENT_TIMEOUT_SECONDS
        )
        result = []
        summary_result = []
        for batch in stream:
            summary_row = batch.summary_row
            summary_row = MessageToDict(
                    summary_row,
                    use_integers_for_enums=False,
                    preserving_proto_field_name=True
                )
            summary_result.append(summary_row)
            for row in batch.results:
                row = MessageToDict(
                    row,
                    use_integers_for_enums=False,
                    preserving_proto_field_name=True
                )
                result.append(row)

                
        if result:
            print(f"{cust_id} has data")

if __name__ == "__main__":
    google_ads_client, google_ads_service = setup_google_ads_connection()

    asyncio.run(
        main(google_ads_client, google_ads_service)
    )

I use python 3.12.9
Here's the version of library used in python when pip freeze

aiohttp==3.9.5
aiosignal==1.3.2
attrs==25.3.0
boto3==1.34.126
botocore==1.34.126
cachetools==5.5.2
certifi==2025.1.31
charset-normalizer==3.4.1
frozenlist==1.6.0
google-ads==26.1.0
google-api-core==2.24.2
google-auth==2.39.0
google-auth-oauthlib==1.2.2
googleapis-common-protos==1.70.0
googlemaps==4.10.0
grpcio==1.71.0
grpcio-status==1.62.3
idna==3.10
iso3166==2.1.1
jmespath==1.0.1
multidict==6.4.3
numpy==2.2.5
oauthlib==3.2.2
pandas==2.2.2
propcache==0.3.1
proto-plus==1.26.1
protobuf==4.25.7
psycopg2-binary==2.9.10
pyasn1==0.6.1
pyasn1_modules==0.4.2
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
redis==5.1.1
requests==2.32.3
requests-oauthlib==2.0.0
rsa==4.9.1
s3transfer==0.10.4
six==1.17.0
tzdata==2025.2
ujson==5.10.0
urllib3==2.4.0
uvloop==0.19.0
yarl==1.20.0

P/S: when I use v17, the logging is normal.

Can you guide me through the steps to get Google Ads logging again?

Ngôn ngữ chính
Python
Star
749
Fork
967
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của googleads/googleads-python-lib

Tất cả issue của googleads/googleads-python-lib

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.