Hello everyone! 

Please explain  why I get in the column data type  
*proto.marshal.collections.repeated.Repeated*    instead of list and how I 
can get list ?   I convert the upload via  new Google Ads API into the 
dataframe  - all  columns are ok but this one:

[image: Marshal3.png]

An example of a value in the  column : [https://site.com/page]

If it helps here is my script: 

/////////////////

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
 
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]}) 
    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 here is the raw upload fragment (which I write to df):

SearchPager<results {
  customer {
    resource_name: "customers/2331356"
    descriptive_name: "Dive"
  }
  campaign {
    resource_name: "customers/23386756/campaigns/119453447"
    status: ENABLED
    name: "GA_Yaponskij_Poisk"
    id: 1194527344986
  }
  ad_group {
    resource_name: "customers/23386756/adGroups/1143496263"
    status: ENABLED
    id: 114349619263
    name: "\320\236\320\261\321\211\320\270\320\265_ 
\320\276\320\261\321\203\321\207\320\265\320\275\320\270\320\265 
\321\217\320\277\320\276\320\275\321\201\320\272\320\276\320\274\321\203"
  }
  ad_group_ad {
    resource_name: "customers/2331386756/adGroupAds/1149619263~8861903960"
    ad {
      resource_name: "customers/277316756/ads/488776713960"
      id: 488861577960
      final_urls: "https://www.site.ru/language-jpn";
      
    }
  }
}

I will be grateful for any help

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/f8cd51b3-df32-4906-befb-e4c448b0525an%40googlegroups.com.

Reply via email to