手记

开启 fiddler 用pycharm 爬虫 报错:HTTPSConnectionPool

requests.exceptions.SSLError: HTTPSConnectionPool(host='t.17track.net', port=443): Max retries exceeded with url: /restapi/track (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

报错原因:requests请求中  默认 验证(verify=True)

解决方案:

res = requests.post(url, data=data, headers=header, cookies=cookie, verify=False)

添加之后可以正常访问,但还会警告,可以忽略

如果感觉看到红色不舒服,添加如下代码禁用警告:

# 禁用安全请求警告
from requests.packages.urllib3.connectionpool import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

1人推荐
随时随地看视频
慕课网APP