Python的requests模块忽略SSL证书验证警告
报错信息如下:
1 | requests.exceptions.SSLError: HTTPSConnectionPool(host='59.197.228.154', port=443): Max retries exceeded with url: /api/datetime (Caused by SSLError(SSLCertVerificationError("hostname '59.197.228.154' doesn't match '124.95.133.232'"))) |
解决办法如下:
创建一个 requests 会话对象,并在该会话中全局禁用 SSL 证书验证警告。
1 | import requests |