pycharm发送请求fiddler抓包失败和警告:InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See


1、fiddler抓包pycharm失败

原来的代码:

r = requests.post(url, data)

此时发送的请求fiddler抓取不了数据

修改为:

fiddler_proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}   # 避免fiddler抓不到请求数据而设置的
r = requests.post(url, data, proxies=fiddler_proxies, verify=False) # verify和proxies均是为了可以正常使用fiddler抓而设

再次尝试,可以正常抓包,但是有警告:InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See

 

2、解决警告:InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See

在发送请求前,添加代码,如下:

fiddler_proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}   # 避免fiddler抓不到请求数据而设置的
# 取消警告:InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See
     requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
r = requests.post(url, data, proxies=fiddler_proxies, verify=False)  # verify和proxies均是为了可以正常使用fiddler抓而设

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM