olemis

Google Adwords snippet #2

Oct 27th, 2010
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.55 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.  account_service.GetAccountInfo()
  24.  account_service.GetClientAccounts()
  25.  
  26. selector = {
  27.   'searchParameters': [
  28.         {
  29.             'type': 'RelatedToKeywordSearchParameter',
  30.             'keywords': [
  31.                 {
  32.                     'text': 'global economy',
  33.                     'matchType': 'BROAD'
  34.                 }]
  35.         },
  36.         {
  37.             'type': 'LanguageTargetSearchParameter',
  38.             'languageTargets': [{'languageCode' : 'en_US'}]
  39.         },
  40.         {
  41.             'type': 'CountryTargetSearchParameter',
  42.             'countryTargets': [{'countryCode' : 'us'}]
  43.         }
  44.      ],
  45.     'ideaType': 'KEYWORD',
  46.     'requestType': 'IDEAS',
  47.     'paging': {
  48.         'startIndex': '0',
  49.         'numberResults': '5'
  50.     }
  51.   }
  52.  
  53. variation_lists = keyword_tool_service.Get(selector)
  54.  
  55. pprint(dir(variation_lists))
Add Comment
Please, Sign In to add comment