-
1、先創建一個session req = requests.session() 2、通過session來把驗證碼下載到本地, code = req.get("https://passport.company-pvt.tongtool.com/captcha.jpg", headers=headers) with open('code.jpg', 'wb') as file: file.write(code.content) file.close 3、使用fiddle對登錄請求分析,傳入的參數如下,其中cap為手工輸入的驗證碼 data = {"u": "", "haveRisk": "https://twerp-staging.tongtool.com/#/goods/mygoods", "username": "******", "password": "****", "captcha": cap} 4、執行登錄 login = req.post(url, headers=headers, params=data)
https://blog.csdn.net/zhouxuan623/article/details/107230683