python 3 requests時報エラーrequests.exceptions.SSLError:HTTPSConnectionPool


エラーメッセージは次のとおりです.requests.exceptions.SSLError: HTTPSConnectionPool(host='www.baidu.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)'),))
まず私は多くの資料を探して、多くの人が証明書検証(verify=False))を閉じてこの問題を解決することができると言って、あるいはGETを行う時、SSL証明書を指定します.
response = requests.get('http://www.baidu.com/', headers = header, verify=False)  

しかし、私は以上の2つの方法でこの問題を完璧に解決していません.そして、InsecureRequestWarningなどの後続のエラーもあります.
正しい方法については、ドキュメント資料を参照してください.
https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl
参考ブログ:http://blog.csdn.net/zahuopuboss/article/details/52964809
以下では、requests依存パッケージをいくつかインストールすれば、この問題を解決できます.
pip3 install cryptography
pip3 install pyOpenSSL
pip3 install certifi