Proxy config for Python Client

430 views
Skip to first unread message

Sha Liu

unread,
Aug 15, 2017, 4:09:27 PM8/15/17
to AdWords API Forum
Hi,

I'm trying to figure out how to configure proxy for Python client 6.1.0, for which the API version I believe is v201708. I passed in proxy info like the following when creating the service client.

        http_proxy=googleads.common.ProxyConfig.Proxy('proxy host w/o http://', 8080)

        https_proxy=googleads.common.ProxyConfig.Proxy('proxy host w/o https://', 8080)

        proxy_config = googleads.common.ProxyConfig(http_proxy=http_proxy, https_proxy=https_proxy)

        client = adwords.AdWordsClient(DEVELOPER_TOKEN, OAUTH_CLIENT, USER_AGENT, client_customer_id=account_id, proxy_config=proxy_config)


However, when accessing the API it looks like oauth2 client still tries to access google servers like dfw25s27-in-f13.1e100.net.https directly. Below is the stack trace concerning the Python client.

  File "/usr/local/lib/python2.7/site-packages/googleads/common.py", line 743, in MakeSoapRequest

    self._header_handler.SetHeaders(self.suds_client)

  File "/usr/local/lib/python2.7/site-packages/googleads/adwords.py", line 554, in SetHeaders

    http_headers = self._adwords_client.oauth2_client.CreateHttpHeader()

  File "/usr/local/lib/python2.7/site-packages/googleads/oauth2.py", line 211, in CreateHttpHeader

    self.Refresh()

  File "/usr/local/lib/python2.7/site-packages/googleads/oauth2.py", line 226, in Refresh

    self.proxy_config.disable_certificate_validation)))

  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 545, in refresh

    self._refresh(http)

  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 749, in _refresh

    self._do_refresh_request(http)

  File "/usr/local/lib/python2.7/site-packages/oauth2client/client.py", line 780, in _do_refresh_request

    body=body, headers=headers)

  File "/usr/local/lib/python2.7/site-packages/oauth2client/transport.py", line 282, in request

    connection_type=connection_type)

  File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1659, in request

    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)

  File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1399, in _request

    (response, content) = self._conn_request(conn, request_uri, method, body, headers)

  File "/usr/local/lib/python2.7/site-packages/httplib2/__init__.py", line 1355, in _conn_request

    response = conn.getresponse()

  File "/usr/local/lib/python2.7/httplib.py", line 1123, in getresponse

    raise ResponseNotReady()

httplib.ResponseNotReady


Any idea whether this can be fixed on our side or is a bug with the Python client?

Thanks,
Sha Liu


Peter Oliquino

unread,
Aug 15, 2017, 11:12:59 PM8/15/17
to AdWords API Forum
Hi Sha,

You may refer to this guide in Github on how to configure your Python client library. Should you encounter any issues, you may get in touch with the Python library owners directly via this link as the issue is more specific to the client library. However, if you encounter any issues with the AdWords API's services or reports, feel free to write back and we'll be happy to assist you.

Best regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages