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