Hey, I've been trying to set up adwords api SANDBOX for python, but it just refuses to work. Is the readme out of date? It seems to be referring to files that don't exist "examples/adspygoogle/adwords/v201109/get_unit_count.py".
I think I am slowly getting somewhere but I cannot for the life of me get the 5 generated accounts. Can someone please help? Attached is what I have so far. -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en
from adspygoogle.adwords.AdWordsClient import AdWordsClient from adspygoogle.common import Utils SERVER = 'https://adwords-sandbox.google.com' EMAIL = '[email protected]' PASSWORD = 'xxxxx' DEBUG = True VERSION = 'v201109' def get_campaigns(client): PAGE_SIZE = 100 # Initialize appropriate service. campaign_service = client.GetCampaignService( 'https://adwords-sandbox.google.com', 'v201109_1') # Construct selector and get all campaigns. offset = 0 selector = { 'fields': ['Id', 'Name', 'Status'], 'paging': { 'startIndex': str(offset), 'numberResults': str(PAGE_SIZE) } } more_pages = True while more_pages: page = campaign_service.Get(selector)[0] # Display results. if 'entries' in page: for campaign in page['entries']: print ('Campaign with id \'%s\', name \'%s\', and status \'%s\' was ' 'found.' % (campaign['id'], campaign['name'], campaign['status'])) else: print 'No campaigns were found.' offset += PAGE_SIZE selector['paging']['startIndex'] = str(offset) more_pages = offset < int(page['totalNumEntries']) print print ('Usage: %s units, %s operations' % (client.GetUnits(), client.GetOperations())) if __name__ == '__main__': headers = { 'email': EMAIL, 'password': PASSWORD, 'userAgent': 'AppEngine Demo', 'clientEmail': 'client_1+%s' % EMAIL, 'developerToken': '%s++AU' % EMAIL, #'applicationToken': 'ignored', } config = { 'debug': Utils.BoolTypeConvert(DEBUG), 'xml_log': 'n', 'units_log': 'n', 'use_auth_token': 'n', 'use_pretty_xml': 'n', } client = AdWordsClient(headers=headers, config=config) client.use_mcc = True get_campaigns(client)
