python client api behind proxy

我只是一个虾纸丫 提交于 2021-01-28 04:32:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!