google-ads-python icon indicating copy to clipboard operation
google-ads-python copied to clipboard

Get All Campaigns Based on Given Example returns Nothing

Open galihlprakoso opened this issue 1 year ago • 0 comments

Related to this previously submitted issue:

  • https://github.com/googleads/google-ads-python/issues/649

I'm facing the same issue.

Code

from google.ads.googleads.client import GoogleAdsClient

customer_id = "<redacted>"


credentials = {
  "developer_token": "<redacted>",
  "refresh_token": "<redacted>",
  "client_id": "<redacted>",
  "client_secret": "<redacted>",
  "use_proto_plus": True,
  "login_customer_id": "<redacted>",
}

print(f"Initializing Google Ads Client...")

client = GoogleAdsClient.load_from_dict(
  credentials
)

print("Getting all ads...")

ga_service = client.get_service("GoogleAdsService", version="v16")
query = """
        SELECT
          campaign.id,
          campaign.name
        FROM campaign
        ORDER BY campaign.id"""

response = ga_service.search_stream(customer_id=customer_id, query=query)
print(f"response: {response}")

for batch in response:
  print(f"batch: {batch}")

Console

Initializing Google Ads Client...
Getting all ads...
response: <google.api_core.grpc_helpers._StreamingResponseIterator object at 0x1078c2460>

Process finished with exit code 0

Is there anything wrong with my implementation? I'm using this specific version

google-ads==23.1.0

galihlprakoso avatar Mar 15 '24 17:03 galihlprakoso