Get_keyword_stats.py (reporting example in google-ads-python):not working

30 views
Skip to first unread message

Harshad GoogleAds

unread,
Sep 3, 2020, 2:43:48 PM9/3/20
to AdWords API and Google Ads API Forum

Hello!
I run example python script (https://github.com/googleads/google-ads-python/blob/master/examples/reporting/get_keyword_stats.py).

I have all the necessary set up done for google ads api

my yaml file looks like below
developer_token: jvX-------A
client_id: 274---------com
client_secret: heU-------Imr9
refresh_token: 1//0g-uNgZ-----yrHH6QElune1j6l0Tc
login_customer_id: (My google ads manager id, I tried both with and without putting this value)

I tried running the file in "jupyter notebook" as well as in "terminal". At both places, the file is not executing. Please find the errors below

Jupyter Notebook:

usage: ipykernel_launcher.py [-h] -c CUSTOMER_ID
ipykernel_launcher.py: error: the following arguments are required: -c/--customer_id
An exception has occurred, use %tb to see the full traceback.

SystemExit: 2
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/IPython/core/interactiveshell.py:3339: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

Terminal ( As its is suggested here

MacBook-Air-57:yaml_with_account_id_cmd harshadkhanapure$ python get_keyword.py -c 9574386950
File "get_keyword.py", line 54
print(f'Keyword text "{criterion.keyword.text.value}" with '
^
SyntaxError: invalid syntax
MacBook-Air-57:yaml_with_account_id_cmd harshadkhanapure$ python get_keyword.py -c/-- 9574386950
File "get_keyword.py", line 54
print(f'Keyword text "{criterion.keyword.text.value}" with '
^

MacBook-Air-57:yaml_with_account_id_cmd harshadkhanapure$ python get_keyword.py -c/-- 3969569860
File "get_keyword.py", line 54
print(f'Keyword text "{criterion.keyword.text.value}" with '
^

MacBook-Air-57:yaml_with_account_id_cmd harshadkhanapure$ python get_keyword.py -c 3969569860
File "get_keyword.py", line 54
print(f'Keyword text "{criterion.keyword.text.value}" with '

I tried using both Manager Account ID and Child Account but code did not work for both. Kindly let me know how can we resolve this issue.

Google Ads API Forum Advisor Prod

unread,
Sep 4, 2020, 12:11:25 PM9/4/20
to harshad...@gmail.com, adwor...@googlegroups.com
Hi Harshad,

Thanks for reaching out. Can you please provide the customer ID(s) that you have tried using in order to run the report so I can check on my end? Additionally, it is worth noting that manager account IDs are not able to run reports. You must be using a customer account ID. 

Regards,
Google Logo
Danica
Google Ads API Team
 


ref:_00D1U1174p._5004Q23x40H:ref

Harshad GoogleAds

unread,
Sep 4, 2020, 1:47:48 PM9/4/20
to AdWords API and Google Ads API Forum
Manager Account:  396-956-9860
Child Account ID: 957-438-6950

Harshad GoogleAds

unread,
Sep 5, 2020, 6:58:15 AM9/5/20
to AdWords API and Google Ads API Forum
Hi Danica,

I tried with child id and it worked. Thanks for your help
Reply all
Reply to author
Forward
0 new messages