Hi Eric,

I am able to run the example that comes with the library, but I was
hoping to integrate the library into our existing configuration system
rather than using the config script to generate pickled data files
that need to be read. I thought I could accomplish that using the
'headers' named parameter. Maybe I also need a 'config' named
parameter?

I want to avoid having to maintain the pickle files somewhere in my
source tree.

-Travis

On Nov 12, 2:57 pm, AdWords API Advisor <[email protected]>
wrote:
> Hi Travis,
>
> There is a example that comes with the library that demonstrates how
> to get all campaigns with the 
> library:http://code.google.com/p/google-api-adwords-python-lib/source/browse/....
> Are you able to run this example successfully?
>
> Best,
> - Eric
>
> On Nov 12, 12:10 pm, Travis B <[email protected]> wrote:
>
> > Hi Eric,
>
> > So I've installed the python library, and I'm having trouble doing a
> > basic 'getAllAdWordsCampaigns' request against the sandbox. I'm having
> > trouble getting up and running with the library. I have a feeling I'm
> > not using it 100% correctly, but I based what I could off the sample
> > code.
>
> > I've got ZSI and PyXML installed on the system.
>
> > Bring on the sample code!>>>>>>>>BEGIN SAMPLE CODE>>>>>>>>>
>
> > from qwobl_ads import config as ad_config
>
> > from aw_api.Client import Client
>
> > class GoogleAWAClient(object):
> >     def __init__(self, email):
> >         self._email = email
> >         headers = {
> >           'email': self._email,
> >           'password': ad_config.google.password,
> >           'clientCustomerId': 'Unknown',
> >           'userAgent': ad_config.google.user_agent,
> >           'developerToken': ad_config.google.developer_token,
> >           'applicationToken': ad_config.google.application_token,
> >           'validateOnly': 'n'
> >         }
>
> >         if(ad_config.google.version == 'sandbox'):
> >             headers['clientEmail'] = 'client_1+' + self._email,
>
> >         self.client = Client(headers=headers)
>
> > if __name__ == '__main__':
> >     gc = GoogleAWAClient('[email protected]')
> >     dummy = {'dummy': 0}
> >     gc.client.CallMethod('https://sandbox.google.com/api/adwords/v13/
> > CampaignService',
> >                          'getAllAdWordsCampaigns', (dummy,), None)
> > <<<<<<<<<<<<<END SAMPLE CODE<<<<<<<<<<<<<<<<<<
>
> > And the error I get is:
>
> > Traceback (most recent call last):
> >   File "aw_api_test.py", line 27, in <module>
> >     'getAllAdWordsCampaigns', (dummy,), None)
> >   File "/home/briggs/lib/python/aw_api/Client.py", line 601, in
> > CallMethod
> >     request)
> >   File "aw_api/WebService.py", line 330, in CallMethod
> > aw_api.Errors.Error/home/briggs/lib/python/aw_api/Errors.py:34:
> > DeprecationWarning: BaseException.message has been deprecated as of
> > Python 2.6
> >   return str(self.message)
> > : 'tuple' object has no attribute 'find'
>
> > On Nov 11, 6:56 pm, AdWords API Advisor <[email protected]>
> > wrote:
>
> > > Hi Travis,
>
> > > The short answer is that SOAPpy isn't readily compatible with the
> > > AdWords API web services.  Our web services are Document/Literal and
> > > SOAPpy only support RPC/Encoded web services.  It is possible to get
> > > SOAPpy to a compatible format, but it takes a lot of manual
> > > manipulation of the requests.  The official AdWords API Python client
> > > library has this functionality built in, and we recommend you use the
> > > library instead of raw SOAPpy requests.
>
> > >  http://code.google.com/p/google-api-adwords-python-lib/
>
> > > Best,
> > > - Eric Koleda, AdWords API Team
>
> > > On Nov 11, 3:44 pm, Travis B <[email protected]> wrote:> Hi folks,
>
> > > > I can't seem to set the networkTargeting field using an updateCampaign
> > > > call on CampaignService. I'm using the SOAPpy framework in python.
>
> > > > The WSDL shows that geoTargeting is a complexType, just like
> > > > networkTargeting, however I am able to set the later simply using
> > > > dictionaries.
>
> > > > Any help is appreciated.
>
> > > > Here's some sample code that reproduces the problem:
> > > > BEGIN ADWORDS SAMPLE CODE>>>>>>>
> > > > import SOAPpy
> > > > from conf import config_dict
>
> > > > headers = SOAPpy.Types.headerType()
>
> > > > headers.email = config_dict['email']
> > > > headers.password = config_dict['password']
> > > > headers.useragent = config_dict['useragent']
> > > > headers.developerToken = config_dict['developerToken']
> > > > headers.applicationToken = config_dict['applicationToken']
> > > > headers.clientEmail = config_dict['clientEmail']
>
> > > > camp_service = SOAPpy.SOAPProxy('https://sandbox.google.com/api/
> > > > adwords/v13/CampaignService', header=headers)
> > > > camp_service.config.debug = 0
>
> > > > camp_service.getAllAdWordsCampaigns(0)
> > > > print camp_service.updateCampaign({'id': 1938, 'geoTargeting':
> > > > {'regionTargets': {'regions': ['US-CA']}}})
> > > > print camp_service.updateCampaign({'id': 1938, 'networkTargeting':
> > > > ['SearchNetwork']})
> > > > <<<<<<<<<<<<<<END ADWORDS SAMPLE CODE
>
> > > > As shown, the second line produces:
>
> > > > SOAPpy.Types.faultType: <Fault soapenv:Server.userException:
> > > > java.lang.IllegalArgumentException: Can not set
> > > > com.google.ads.netapi.services.datamodel.NetworkTarget field
> > > > com.google.ads.netapi.services.campaign.CampaignData.networkTargeting
> > > > to [Ljava.lang.String;: <SOAPpy.Types.structType detail at
> > > > 17938624>: ...
>
> > > > If I change the second call to:
> > > > print camp_service.updateCampaign({'id': 1938, 'networkTargeting':
> > > > {'networkTypes': ['SearchNetwork']}})
>
> > > > I get:
> > > > SOAPpy.Types.faultType: <Fault soapenv:Server.userException:
> > > > java.lang.IllegalArgumentException: Can not set
> > > > [Lcom.google.ads.netapi.services.datamodel.NetworkType; field
> > > > com.google.ads.netapi.services.datamodel.NetworkTarget.networkTypes to
> > > > [Ljava.lang.String;: <SOAPpy.Types.structType detail at
> > > > 14784704>: ....
>
> > > > -Travis

--

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=.


Reply via email to