Fiddler开启后,Pycharm无法调试https的解决
不开启Fiddler,在Pycharm中requests发送https请求,返回的结果是:
url = 'https://www.baidu.com/'
response = r.get(url)
print(response.url)
print(response.status_code)
https://www.baidu.com/
200
开启Fiddler,在Pycharm中requests发送https请求,返回错误结果
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.baidu.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')))
解决办法:
在get请求后面加verify=False
response = r.get(url, verify=False)
返回结果:
: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn(
https://www.baidu.com/
200
有错误提示,但不影响!