问题
I have my proxy setup in my environment and python does see it. If I do os.environ['http_proxy'], I do see the proxy specified (and all of my other applications use it).
However, when I try to use the python google client api (calendar), it appears it isn't being used even though a rough inspection indicates the default http instance is using proxy from environment.
service, flags = sample_tools.init(
argv, 'calendar', 'v3', __doc__, __file__,
scope='https://www.googleapis.com/auth/calendar'
)
Inside that call, I see it is doing:
http = credentials.authorize(http = httplib2.Http())
Which ultimately is doing:
def __init__(self, cache=None, timeout=None,
proxy_info=proxy_info_from_environment,
ca_certs=None, disable_ssl_certificate_validation=False):
Shouldn't the proxy_info_from_environment be picking it up? On a side note, when I added a breakpoint inside that function, it was never hit. Obviously, that is the reason I'm not getting it set up with the proxy, but it should be, right?
来源:https://stackoverflow.com/questions/34768833/python-client-api-behind-proxy