How to make Python use CA certificates from Mac OS TrustStore?

前端 未结 6 1739
遥遥无期
遥遥无期 2020-11-30 04:05

I need to use curtom root certificates on the company intranet and loading them in the Mac OS TrustStore (KeyChain) does solve the problem for all browsers and GUI apps.

6条回答
  •  星月不相逢
    2020-11-30 04:19

    Mac brew install python env.

    $ python3
    Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21) 
    [Clang 6.0 (clang-600.0.57)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import certifi
    >>> certifi.where()
    '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/certifi/cacert.pem'
    >>> 
    

    Or from the command line:

    $ python -m certifi
    

    then need link cacert.pem as cert.pem

    $ ln -s /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/certifi/cacert.pem cert.pem
    $ pwd
    /Library/Frameworks/Python.framework/Versions/3.7/etc/openssl
    
    rehash
    

    then work fine.

提交回复
热议问题