I'm using this in python and it works great for me:
# Initialize client object.
headers = {
'email': '[email protected]',
'password': 'mylovleypass',
'userAgent': 'Fetcher',
'clientEmail': '[email protected]',
'developerToken': '[email protected]++usd',
'validateOnly': 'n'
}
client = Client(headers=headers)
Things works smoothly after that:
campaign_service = client.GetCampaignService(
'https://adwords-sandbox.google.com', 'v200909')
# Construct selector and get all campaigns.
selector = {}
campaigns = campaign_service.Get(selector)[0]
# Display results.
if 'entries' in campaigns:
for campaign in campaigns['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.'
print
print ('Usage: %s units, %s operations' % (client.GetUnits(),
client.GetOperations()))
On Mar 23, 8:13 am, dsay <[email protected]> wrote:
> Moreover the link that you have provided is for v12. Will it be same
> for v2009?
>
> On Mar 23, 7:27 am, AdWords API Advisor <[email protected]>
> wrote:
>
> > Hi,
>
> > This error is being returned because the header values you are using
> > are not valid for the sandbox. More information on how to set headers
> > in the sandbox is available here:
>
> > http://code.google.com/apis/adwords/docs/developer/adwords_api_sandbo...
> > http://www.youtube.com/watch?v=cqVtUdB975M
>
> > Best,
> > - Eric Koleda, AdWords API Team
>
> > On Mar 20, 3:10 pm, dsay <[email protected]> wrote:
>
> > > adwordsGoogleHeader = {}
> > > adwordsGoogleHeader['applicationToken'] =
> > > Types.untypedType('TOK')
> > > adwordsGoogleHeader['authToken'] = Types.untypedType('TOK')
> > > adwordsGoogleHeader['clientEmail'] =
> > > Types.untypedType('EMAIL')
> > > adwordsGoogleHeader['developerToken'] =
> > > Types.untypedType('TOK')
> > > adwordsGoogleHeader['userAgent'] = Types.untypedType('UA')
> > > adwordsGoogleHeader['validateOnly'] = Types.untypedType('1')
>
> > > adwordsGoogleHeaderHOLD = Types.headerType()
>
> > > adwordsGoogleHeaderHOLD._addItem('RequestHeader',adwordsGoogleHeader)
> > > #adwordsGoogleHeaderHOLD.__ns = 'https://adwords.google.com/
> > > api/adwords/cm/v200909'
> > > adwordsGoogleHeaderHOLD._setAttr(
> > > 'xmlns',
> > > 'https://adwords.google.com/api/adwords/cm/v200909')
>
> > > On Mar 19, 11:41 pm, "Joshua J. Kugler" <[email protected]> wrote:
>
> > > > On Friday 19 March 2010,dsayelucidated thus:
>
> > > > > I am not sure if someone is able to use client library for python as
> > > > > I continue to get the following error
>
> > > > > Traceback (most recent call last):
> > > > > File "get_related_keywords.py", line 53, in <module>
> > > > > page = targeting_idea_service.Get(selector)[0]
> > > > > File "../../aw_api/TargetingIdeaService.py", line 105, in Get
> > > > > 'TargetingIdea', self.__loc, request)
> > > > > File "../../aw_api/WebService.py", line 350, in CallMethod
> > > > > raise ValidationError(error['data'])
> > > > > aw_api.Errors.ValidationError: Invalid headers for 'https://adwords-
> > > > > sandbox.google.com', see
> > > > >http://code.google.com/apis/adwords/docs/developer/adwords_api_sandbo
> > > > >x.html#requestheaders.
>
> > > > > I have tried to run in python 2.5 and 2.6 and on ubuntu and fedora.
> > > > > Its giving same error everywhere.
>
> > > > What code are you using to set your headers?
>
> > > > j
>
> > > > --
> > > > Joshua Kugler
> > > > Part-Time System Admin/Programmerhttp://www.eeinternet.com
> > > > PGP Key:http://pgp.mit.edu/ID0x73B13B6A
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Have you migrated to v200909 yet?
The v13 sunset is on April 22, 2010.
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
To unsubscribe from this group, send email to
adwords-api+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.