Hi! I run this Python code:
/////////////////
import argparse
import sys
import pandas as pd
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException
customer_id = '*****'
client = GoogleAdsClient.load_from_storage("ga.yaml")
ga_service = client.get_service("GoogleAdsService")
customer_service = client.get_service("CustomerService")
resource_name = customer_service.customer_path(customer_id)
customer = customer_service.get_customer(resource_name=resource_name)
ga_service = client.get_service("GoogleAdsService")
query = """
SELECT
customer.descriptive_name,
campaign.id,
campaign.name,
campaign.status,
ad_group.id,
ad_group.name,
ad_group.status,
ad_group_ad.ad.id,
ad_group_ad.ad.final_urls,
ad_group_ad.ad.tracking_url_template
FROM ad_group_ad
WHERE segments.date DURING TODAY AND campaign.status = 'ENABLED' AND
ad_group.status = 'ENABLED' """
search_request = client.get_type("SearchGoogleAdsRequest")
search_request.customer_id = customer_id
search_request.query = query
results = ga_service.search(request=search_request)
df1 = []
for row in results:
campaign = row.campaign
ad_group = row.ad_group
ad_group_ad = row.ad_group_ad
df2 = pd.DataFrame({'account_name':[customer.descriptive_name],
'campaign.id': [campaign.id], 'campaign.name':
[campaign.name],'ad_group.id':[ad_group.id], 'ad_group.name':
[ad_group.name],'ad_group_ad.ad.id':[ad_group_ad.ad.id],
'ad_group_ad.ad.final_urls': [ad_group_ad.ad.final_urls],
'ad_group_ad.ad.tracking_url_template':
[ad_group_ad.ad.tracking_url_template]})
print(
customer.descriptive_name,
campaign.id,
campaign.name,
campaign.status,
ad_group.id,
ad_group.name,
ad_group.status,
ad_group_ad.ad.id,
ad_group_ad.ad.final_urls,
ad_group_ad.ad.tracking_url_template
)
df1.append(df2)
df3 = pd.concat(df1, ignore_index=True)
///////////////////////
And this is my output dataframe:
[image: Marshal2.png]
1) Why do I get proto.marshal.collections.repeated.Repeated type? * In the
Adwords API it was a list.
2) How can I convert this type to List?
Thanks
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/aa3d4ff3-d626-45c7-824f-c7ac843832d4n%40googlegroups.com.