olemis

Google Adwords snippet #1

Oct 27th, 2010
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.48 KB | None | 0 0
  1. from adspygoogle.common import SOAPPY
  2. from adspygoogle.common.Errors import Error
  3. from adspygoogle.adwords.AdWordsClient import AdWordsClient
  4.  
  5. from pprint import pprint
  6.  
  7. headers = {
  8.       'email' : 'user@another_domain.com',
  9.       'password' : 'canhurtyoureyes',
  10.       'useragent' : "UA",
  11.       }
  12.  
  13. headers['developerToken'] = 'user@another_domain.com' + '++' + 'USD'
  14. headers['applicationToken'] = 'apptoken_works_with_v13'
  15.  
  16. namespace = 'https://adwords-sandbox.google.com'
  17. apiver = 'v201008'
  18.  
  19. client = AdWordsClient(headers, {'soap_lib' : SOAPPY, 'home' : '.'})
  20. keyword_tool_service = client.GetTargetingIdeaService(namespace, apiver)
  21. estimator_service = client.GetTrafficEstimatorService(namespace, apiver)
  22.  
  23. selector = {
  24.   'searchParameters': [
  25.         {
  26.             'type': 'RelatedToKeywordSearchParameter',
  27.             'keywords': [
  28.                 {
  29.                     'text': 'global economy',
  30.                     'matchType': 'BROAD'
  31.                 }]
  32.         },
  33.         {
  34.             'type': 'LanguageTargetSearchParameter',
  35.             'languageTargets': [{'languageCode' : 'en_US'}]
  36.         },
  37.         {
  38.             'type': 'CountryTargetSearchParameter',
  39.             'countryTargets': [{'countryCode' : 'us'}]
  40.         }
  41.      ],
  42.     'ideaType': 'KEYWORD',
  43.     'requestType': 'IDEAS',
  44.     'paging': {
  45.         'startIndex': '0',
  46.         'numberResults': '5'
  47.     }
  48.   }
  49.  variation_lists = keyword_tool_service.Get(selector)
  50.  
  51. pprint(dir(variation_lists))
Add Comment
Please, Sign In to add comment