Python Requests - How to use system ca-certificates (debian/ubuntu)?

前端 未结 3 639
我寻月下人不归
我寻月下人不归 2020-11-27 03:07

I\'ve installed a self-signed root ca cert into debian\'s /usr/share/ca-certificates/local and installed them with sudo dpkg-reconfigure ca-certificates

3条回答
  •  余生分开走
    2020-11-27 03:18

    My two cents:

    Thanks to this other answer, which had me check on actual requests code, I figured out that you don't have to use the env variable but can just set the "verify" param in your request:

    requests.get("https://whatever", verify="/my/path/to/cacert.crt", ...)
    

    It is also documented, although I could only find the documentation after having made the discovery (and the pypi project points to a dead link for doc) :D

提交回复
热议问题