Giter Site home page Giter Site logo

Comments (8)

dreyco676 avatar dreyco676 commented on May 26, 2024

I'm on python 3.3.4 on a windows 7 x64 system.

from googleads-python-lib.

jdilallo avatar jdilallo commented on May 26, 2024

We're looking into this.

from googleads-python-lib.

dreyco676 avatar dreyco676 commented on May 26, 2024

Let me know if you need any additional information, I'd be happy to provide.

I did read that this might have something to do with urllib and that urllib2 may handle the proxy differently.

from googleads-python-lib.

rodrigoreis22 avatar rodrigoreis22 commented on May 26, 2024

Same problem here guys.. I'm trying to make this work for one month now. Before I was using the old python library.. but now I'm using this new one.

Here's my info so far:

Proxy: Squid 3.1.10
OS: CentOS 6.5
Python 2.7.6

I'm opening the client like this:
client = adwords.AdWordsClient(DEVELOPER_TOKEN, oauth2_client, USER_AGENT, CLIENT_CUSTOMER_ID,https_proxy='proxy.qa.vmcommerce.intra:3128')

But the code stuck on the point where suds try to make a request to get the WSDL info from url: https://adwords.google.com/api/adwords/cm/v201402/CampaignService?wsdl .

On adwords.py (method GetService) you have:

client = suds.client.Client(
self._SOAP_SERVICE_FORMAT %
(server, _SERVICE_MAP[version][service_name], version, service_name))

I think the problem here is that the https_proxy info is not being passed to suds Client constructor. The https_proxy config is being used a few lines after this:
if self.https_proxy: client.set_options(proxy={'https': self.https_proxy})

And then I got this exception:
Traceback (most recent call last):
File "get_campaigns.py", line 16, in
campaign_service = client.GetService('CampaignService', version='v201402')
File "/opt/python2.7/lib/python2.7/site-packages/googleads-1.0.3-py2.7.egg/googleads/adwords.py", line 193, in GetService
(server, _SERVICE_MAP[version][service_name], version, service_name))
File "/opt/python2.7/lib/python2.7/site-packages/suds_jurko-0.6-py2.7.egg/suds/client.py", line 115, in init
self.wsdl = reader.open(url)
File "/opt/python2.7/lib/python2.7/site-packages/suds_jurko-0.6-py2.7.egg/suds/reader.py", line 150, in open
d = self.fn(url, self.options)
File "/opt/python2.7/lib/python2.7/site-packages/suds_jurko-0.6-py2.7.egg/suds/wsdl.py", line 136, in init
d = reader.open(url)
File "/opt/python2.7/lib/python2.7/site-packages/suds_jurko-0.6-py2.7.egg/suds/reader.py", line 74, in open
d = self.download(url)
File "/opt/python2.7/lib/python2.7/site-packages/suds_jurko-0.6-py2.7.egg/suds/reader.py", line 92, in download
fp = self.options.transport.open(Request(url))
File "/opt/python2.7/lib/python2.7/site-packages/suds_jurko-0.6-py2.7.egg/suds/transport/https.py", line 62, in open
return HttpTransport.open(self, request)
File "/opt/python2.7/lib/python2.7/site-packages/suds_jurko-0.6-py2.7.egg/suds/transport/http.py", line 67, in open
return self.u2open(u2request)
File "/opt/python2.7/lib/python2.7/site-packages/suds_jurko-0.6-py2.7.egg/suds/transport/http.py", line 132, in u2open
return url.open(u2request, timeout=tm)
File "/opt/python2.7/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/opt/python2.7/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/opt/python2.7/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/opt/python2.7/lib/python2.7/urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/opt/python2.7/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
urllib2.URLError: urlopen error [Errno 101] Network is unreachable

Please let me know if you need any tests from my end.

from googleads-python-lib.

rodrigoreis22 avatar rodrigoreis22 commented on May 26, 2024

New progress:

If you pass the parameter proxy= to suds Client it will work:

from suds.client import Client
import logging

logging.basicConfig(level=logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)

url = 'https://adwords.google.com/api/adwords/cm/v201402/CampaignService?wsdl'
client = Client(url, proxy={ 'http' : 'http://proxy.qa.vmcommerce.intra:3128', 'https' : 'http://proxy.qa.vmcommerce.intra:3128' })
print client

from googleads-python-lib.

rodrigoreis22 avatar rodrigoreis22 commented on May 26, 2024

Code forked and working fine now on https://github.com/rodrigoreis22/googleads-python-lib

from googleads-python-lib.

jdilallo avatar jdilallo commented on May 26, 2024

Alright, so it seems like there's 2 problems here. I'll work in the fix rodrigoreis22 mentioned: passing the proxy into the Client constructor instead, so the fetching of the WSDL uses the proxy too.

As for the original reported issue by dreyco676, I'm less certain. Was this the cause of your problem too? It seems that urllib2 isn't designed to use a proxy at an https:// URL, resulting in timeouts or connection reset by peer messages. Using a proxy with an http:// address resolves this, but I'm not certain of the security implications yet.

from googleads-python-lib.

msaniscalchi avatar msaniscalchi commented on May 26, 2024

The issues brought up earlier have been resolved, though feel free to comment if you have additional questions.

from googleads-python-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.