Host Fails to Respond through Proxy
I have successfully run the script 'get_keyword_ideas.py' on my local machine without a proxy. When I deploy the script on a server with a proxy and I set the googleads.yaml https proxy I am unable to connect to the host.
I have verified that I am able to hit the following:
- I am able to resolve googleapis.com, adwords.google.com with other applications
- I have tried setting the proxy via os.environ['https_proxy'] = 'https://example:1234'
Error
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
During handling of the above exception, another exception occurred: urllib.error.URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>
I'm on python 3.3.4 on a windows 7 x64 system.
We're looking into this.
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.
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
Please let me know if you need any tests from my end.
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
Code forked and working fine now on https://github.com/rodrigoreis22/googleads-python-lib
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.
The issues brought up earlier have been resolved, though feel free to comment if you have additional questions.