Skip to content
Advertisement

Python3 BigQuery or Google Cloud Python through HTTP Proxy

How to route BigQuery client calls through HTTP Proxy ?

Before Posting this, I tried following but it is still not routing through http proxy. And the Google Cloud service credentials are set through shell environment variable GOOGLE_APPLICATION_CREDENTIALS

JavaScript

Outgoing traffic ( 172.217.x.x belongs to googleapis.com ) not routing through HTTP Proxy ,

JavaScript

Advertisement

Answer

Answering the question myself as I found the reason/solution.

Reason:

google-cloud-python library uses httplib2, As of this writing httplib2 has two code bases for python 2 and python 3. The Python 3 version of httplib2 is not implemented with socks/proxy support. Please refer to httplib2’s repo#init_py.

Work Around:

There is a discussion to move google-cloud-python from httplib2 to urllib3, but in the mean time one can use httplib2shim

JavaScript
Advertisement