Get_keyword_ideas issue getting the keyword and search volume

18 views
Skip to first unread message

Stephen Barrett

unread,
Jan 24, 2019, 7:19:38 PM1/24/19
to AdWords API and Google Ads API Forum
Hi!

I'm running on Python and I am having a little bit of trouble with the display results portion of the script. Instead of printing the results, I wanted to save the keyword and search volume into a list to use elsewhere. I am trying to just store the variables and I'm getting this error: 

sv undefinedattributes = {'KEYWORD_TEXT': 'seo'}

KeyError: 'SEARCH_VOLUME' 
      args = ('SEARCH_VOLUME',) 
      with_traceback = <built-in method with_traceback of KeyError object>



Here is the portion of the script:
# Display results.
   
if 'entries' in page:
      keyword_list
= []
     
for result in page['entries']:
        attributes
= {}
       
for attribute in result['data']:
         
print(attribute)
          attributes
[attribute['key']] = getattr(attribute['value'], 'value', '0')
          kw
= attributes['KEYWORD_TEXT']
          sv
= attributes['SEARCH_VOLUME']
       
#print ('Keyword with "%s" text and average monthly search volume '
       
#       '"%s".'
       
#       % (attributes['KEYWORD_TEXT'], attributes['SEARCH_VOLUME']))
       
print(kw)
   
else:
     
print ('No related keywords were found.')


When I don't try and save them as variables, or into a list, and just print them, it works. 

Please advise?

googleadsapi...@google.com

unread,
Jan 24, 2019, 11:23:15 PM1/24/19
to AdWords API and Google Ads API Forum
Hi Stephen,

Seems your issue are more related to the implementation of Python client library rather than the AdWords API. I would suggest to post your concern here as the Python client library owners are better equipped to assist you here.

Thanks and regards,
Luis
AdWords API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
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 adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/deba3d84-f85c-4461-9e29-f5cf62f275d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages