googleads / googleads-python-lib

The Python client library for Google's Ads APIs
Apache License 2.0
686 stars 975 forks source link

create_dfa_client_without_yaml.py example doesn't work #4

Closed elcct closed 10 years ago

elcct commented 10 years ago

First of all:

dfa_client.GetService('CampaignService')

isn't right, because there is no 'CampaignService':

googleads.errors.GoogleAdsValueError: Unrecognized service for the DFA API. Service given: CampaignService Supported services: ('ad', 'advertiser', 'advertisergroup', 'campaign', 'changelog', 'contentcategory', 'c
reative', 'creativefield', 'creativegroup', 'login', 'network', 'placement', 'site', 'size', 'spotlight', 'strategy', 'subnetwork', 'user', 'userrole', 'report')

Calling:

  results = dfa_client.GetService('campaign').getCampaignsByCriteria({})

Results in:

ERROR:suds.client:<suds.sax.document.Document instance at 0x00000000032899C8>
Traceback (most recent call last):
  File "create_dfa_client_without_yaml.py", line 60, in <module>
    APPLICATION_NAME)
  File "create_dfa_client_without_yaml.py", line 51, in main
    results = dfa_client.GetService('campaign').getCampaignsByCriteria({})
  File "C:\Python27\lib\site-packages\googleads\common.py", line 229, in MakeSoapRequest
    for arg in args])
  File "C:\Python27\lib\site-packages\suds\client.py", line 521, in __call__
    return client.invoke(args, kwargs)
  File "C:\Python27\lib\site-packages\suds\client.py", line 581, in invoke
    result = self.send(soapenv)
  File "C:\Python27\lib\site-packages\suds\client.py", line 619, in send
    description=tostr(e), original_soapenv=original_soapenv)
  File "C:\Python27\lib\site-packages\suds\client.py", line 670, in process_reply
    raise WebFault(fault, replyroot)
suds.WebFault: Server raised fault: '20001 - You must specify request parameter for method .'

It seems like this library doesn't work at all - whatever call I make I get:

suds.WebFault: Server raised fault: '20001 - You must specify request parameter for method .'

I tried it with Python 2.7.

elcct commented 10 years ago

Just to update. I managed to get it working.

As in the example:

.getCampaignsByCriteria({})

Call above will not work with empty criteria. I didn't have any campaigns to search for so first I tried different method:

dfa_client.GetService('size').getSizes({})

It gave me the same error as in my first post, but same kind of call works with legacy lib.

When changed to:

dfa_client.GetService('size').getSizes({'ids': [0]})

It worked, but then I got error:

suds.WebFault: Server raised fault: '1071 - Failed to authenticate. User profile name xxx@yyy.com not found.

After I put USER_PROFILE_NAME = 'xxx' omitting domain name it worked.

I hope that helps...

I ended up using legacy lib for now.

jdilallo commented 10 years ago

Hey there,

Thanks for reporting this. There's a few problems here that I'm fixing right now.

I'll make a release to fix this in about an hour.

jdilallo commented 10 years ago

The release fixing these issues it out.

elcct commented 10 years ago

Login issue was a mix-up - I have DFA username same as Google account username I used to authenticate with OAuth.

I hope this will change in future - use of two accounts to operate the API seems really weird.

Thank you.