Result of execute() giving list not dict - python client

178 views
Skip to first unread message

dee

unread,
Sep 10, 2020, 7:20:28 AM9/10/20
to AdMob API Developer Forum
HI Guys,

I am trying to get the Admob network report generate API in python. the old adSence API was returning the dictionary so it was easy to convert into the CSV formate. now the new AdMob API is returning the List and inside the list the JSON. could you please suggest if it is possible to get the result in structure formate from API. 

google me

unread,
Sep 10, 2020, 8:02:20 AM9/10/20
to AdMob API Developer Forum
also, I don't see API has an alt=csv option available? 
do we need a separate code for converting to CSV in the client library like in python? 

google me

unread,
Sep 10, 2020, 1:46:33 PM9/10/20
to AdMob API Developer Forum
How do we parse the GenerateMediationReportResponse in python? do we have any method? 

Maksym Prokhorenko

unread,
Sep 10, 2020, 2:56:02 PM9/10/20
to AdMob API Developer Forum
Hello

The alt=csv is not supported yet. But you could find a java example on my github project.  Most likely you would need to implement something similar.

Many Thanks

google me

unread,
Sep 10, 2020, 3:01:17 PM9/10/20
to AdMob API Developer Forum
HI Maksym,
Thank you for your respose. 
I am using client API using Python do we have any example? the execute statement gives a list and bit and bit different to parse than Adsense which was very straight forward. 

Maksym Prokhorenko

unread,
Sep 10, 2020, 6:49:28 PM9/10/20
to AdMob API Developer Forum
Just provided a basic example on the stack overflow and shared the code on github.

google me

unread,
Sep 11, 2020, 3:21:38 AM9/11/20
to AdMob API Developer Forum

I am able to fetch the data but when I include  MATCH_RATE and IMPRESSION_CTR metrics its doesn't show up the records. 

I made some changes to the code below to get them in

if row.get('metricValues'):
for key, value in row.get('metricValues').items():
dm.update({key: next(filter(None, [value.get('value'), value.get('microsValue'), value.get('integerValue'), value.get('doubleValue')]))})

return self.admob.accounts().mediationReport().generate(
parent='accounts/{}'.format(publisher_id),
body=request).execute()

I added the value.get('doubleValue') the but it failed for the MATCH_RATE and IMPRESSION_CTR metrics. 

AdMob API Forum Advisor

unread,
Sep 16, 2020, 9:22:26 PM9/16/20
to dti...@gmail.com, google-admob-api...@googlegroups.com
Hello Dee,

Thanks for your feedback on your interest in a feature that would return report data in a csv format. We will consider your input into our prioritization planning.

All the Best,
Google Logo
Amira Badreldin
AdMob API Team
 


ref:_00D1U1174p._5004Q24aGoY:ref

google me

unread,
Oct 11, 2020, 5:51:50 PM10/11/20
to AdMob API Developer Forum
HI Admob Team,

Is there any way we get the AdMob mediation report using python client in structure formate? without writing parser. 

AdMob API Forum Advisor

unread,
Oct 13, 2020, 8:17:35 PM10/13/20
to dti...@gmail.com, google-admob-api...@googlegroups.com
Hello there,

Thank you for reaching out to the forum. At the moment, the AdMob API python samples may require a parser for individual needs. If you could please elaborate on the format required, we will consider your input into our prioritization planning.

All the best,
Reply all
Reply to author
Forward
0 new messages