AdWords API Re: v13 Problem setting networkTargeting in python using SOAPpy
Hi Travis, The pickle files aren't required for the library to work, and you should be able to pass in your credentials to the constructor of the Client. More information about the parameters for that constructor can be found here: http://code.google.com/p/google-api-adwords-python-lib/source/browse/trunk/aw_api/Client.py#76. Best, - Eric On Nov 12, 4:28 pm, Travis B wrote: > 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 > 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 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('@qwobl.com') > > > dummy = {'dummy': 0} > > > gc.client.CallMethod('https://sandbox.google.com/api/adwords/v13/ > > > CampaignService', > > > 'getAllAdWordsCampaigns', (dummy,), None) > > > > > > And the error I get is: > > > > Traceback (most recent call last): > > > File "aw_api_test.py", line 27, in > > > '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 > > > 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 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 = co
AdWords API Re: v13 Problem setting networkTargeting in python using SOAPpy
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 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 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('@qwobl.com') > > dummy = {'dummy': 0} > > gc.client.CallMethod('https://sandbox.google.com/api/adwords/v13/ > > CampaignService', > > 'getAllAdWordsCampaigns', (dummy,), None) > > > > And the error I get is: > > > Traceback (most recent call last): > > File "aw_api_test.py", line 27, in > > '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 > > 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 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']}) > > > > < > > > > As shown, the second lin
AdWords API Re: v13 Problem setting networkTargeting in python using SOAPpy
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/trunk/demo/get_all_campaigns.py. Are you able to run this example successfully? Best, - Eric On Nov 12, 12:10 pm, Travis B 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('@qwobl.com') > dummy = {'dummy': 0} > gc.client.CallMethod('https://sandbox.google.com/api/adwords/v13/ > CampaignService', > 'getAllAdWordsCampaigns', (dummy,), None) > > And the error I get is: > > Traceback (most recent call last): > File "aw_api_test.py", line 27, in > '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 > 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 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']}) > > > < > > > As shown, the second line produces: > > > > SOAPpy.Types.faultType: > > 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;: > > 17938624>: ... > > > > If I change the second call to: > > > print camp_service.updateCampaign({'id': 1938, 'networkTargeting': > > > {'networkTypes': ['SearchNetwork']}}) > > > > I get: > > > SOAPpy.Types.faultType: > > java.lang.IllegalArgumentException: Can not set > > > [Lcom.google.ads.netapi.services.datamodel.NetworkType; field > > > com.google.ads.netapi.services.datamo
AdWords API Re: v13 Problem setting networkTargeting in python using SOAPpy
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('q...@qwobl.com') dummy = {'dummy': 0} gc.client.CallMethod('https://sandbox.google.com/api/adwords/v13/ CampaignService', 'getAllAdWordsCampaigns', (dummy,), None) '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 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 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']}) > > < > > As shown, the second line produces: > > > SOAPpy.Types.faultType: > 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;: > 17938624>: ... > > > If I change the second call to: > > print camp_service.updateCampaign({'id': 1938, 'networkTargeting': > > {'networkTypes': ['SearchNetwork']}}) > > > I get: > > SOAPpy.Types.faultType: > 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;: > 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 adwords-...@googlegroups.com. To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/adwords-api?hl=.
AdWords API Re: v13 Problem setting networkTargeting in python using SOAPpy
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 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']}) > < > As shown, the second line produces: > > SOAPpy.Types.faultType: 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;: 17938624>: ... > > If I change the second call to: > print camp_service.updateCampaign({'id': 1938, 'networkTargeting': > {'networkTypes': ['SearchNetwork']}}) > > I get: > SOAPpy.Types.faultType: 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;: 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 adwords-...@googlegroups.com. To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/adwords-api?hl=.