How do I have python httplib accept untrusted certs?

前端 未结 2 1179
有刺的猬
有刺的猬 2020-12-17 09:55

How do I have python httplib accept untrusted certs? I created a snake oil/self signed cert on my webserver, and my python client fails to connect as I am using a untrusted

2条回答
  •  执念已碎
    2020-12-17 10:18

    From inspecting the Python 2.7.14 source code, you may set an environment variable

    PYTHONHTTPSVERIFY=0
    

    and this will cause certificate verification to be disabled by default (this will apply to all requests from your program).

    I believe this works from 2.7.12+ - but it does not apply to 3.x.

    Ref. PEP 493: Verify HTTPS by default, but allow envvar to override that

提交回复
热议问题