googleads / google-ads-python

Google Ads API Client Library for Python
Apache License 2.0
522 stars 480 forks source link

Bug on my side or there is a bug in library #543

Closed iPythonezta closed 2 years ago

iPythonezta commented 2 years ago

I am trying to use Adwords API to access campaigns and reports from Google ADs by using python client libraries. I got the developer token, client ID, client_secret and refresh token by following the necessary steps in the documentation. When I ran the get_campaigns.py, I came across this error- AttributeError: 'str' object has no attribute 'get'. Does this mean that my googleads YAML file is not configured properly? I am new to this. P.S - In general, I would like to understand YAML files better for configuring it in the right way. Are there any links for the same? Kindly help me out on this.

BenRKarl commented 2 years ago

Hi @BloggingKIng could you share the full stack trace for the error? It's not clear from where in the codebase the error is originating.

iPythonezta commented 2 years ago

Traceback (most recent call last): File "adwords.py", line 127, in googleads_client = GoogleAdsClient.load_from_storage(version="v6") File "D:\Softwares\Anaconda\lib\site-packages\google\ads\googleads\client.py", line 291, in load_from_storage config_data = config.load_from_yaml_file(path) File "D:\Softwares\Anaconda\lib\site-packages\google\ads\googleads\config.py", line 69, in validation_wrapper config_dict = func(*args, kwargs) File "D:\Softwares\Anaconda\lib\site-packages\google\ads\googleads\config.py", line 87, in parser_wrapper config_dict = func(*args, *kwargs) File "D:\Softwares\Anaconda\lib\site-packages\google\ads\googleads\config.py", line 274, in load_from_yaml_file return parse_yaml_document_to_dict(yaml_doc) File "D:\Softwares\Anaconda\lib\site-packages\google\ads\googleads\config.py", line 69, in validation_wrapper config_dict = func(args, kwargs) File "D:\Softwares\Anaconda\lib\site-packages\google\ads\googleads\config.py", line 88, in parser_wrapper parsed_config = convert_login_customer_id_to_str(config_dict) File "D:\Softwares\Anaconda\lib\site-packages\google\ads\googleads\config.py", line 375, in convert_login_customer_id_to_str login_customer_id = config_data.get("login_customer_id") AttributeError: 'str' object has no attribute 'get'

iPythonezta commented 2 years ago

The detail of the issue is pasted above and sorry for being late. I actually never logged into GitHub for the last 10 days :-)

BenRKarl commented 2 years ago

@BloggingKIng without including any compromising tokens, (i.e. developer token, client ID) could you share how your google-ads.yaml file is formatted? For some reason it appears as though it's being parsed into a string instead of a dictionary, and I'm not sure how that would happen.

BenRKarl commented 2 years ago

@BloggingKIng I'm assuming no news is good news and you've resolved this issue, but if not please reopen this.