python - 如何使用验证码提交表单
问题描述
我正在尝试在亚马逊网站上完成验证码。但是在提交表单时得到<Response [503]>
. 验证码正在正确解决。可能是什么问题?这就是我的代码的样子
def solve_captcha(self, content):
captcha_img = content.find("form").find("img")['src']
urllib.request.urlretrieve(captcha_img, "captcha.png")
with open('captcha.png', 'rb') as captcha_file:
captcha = self.api.solve(captcha_file)
url = 'https://www.amazon.com/errors/validateCaptcha'
payload = {'field-keywords' : str(captcha.await_result())}
session = requests.Session()
s = session.post(url, data=payload, headers={"Referer": "https://www.amazon.com/"}, proxies=self.proxy)
return s
解决方案
推荐阅读
- c++ - C++ 只运行一段时间
- node.js - 安全访问渲染器进程中基于节点的模块
- angular - 拒绝在框架中显示“https://stackblitz.com/edit/zknwqv.run”,因为它将“X-Frame-Options”设置为“sameorigin”
- java - 如何在卡片布局下的面板中添加功能性 Java 键侦听器?
- python - 如何修复 ImportError:在 INSTALLED_APPS 中作为“apps.comments”存在时,没有名为 comments.models 的模块?
- pip - pip search 显示 apache-beam 2.9 但 pip install apache-beam 只安装了 apache-beam2.2
- c++ - C++ Vector Initialize with INT_MIN crash
- regex - sed:在块之后追加
- angular - Angular 7:如何从类中获取数据
- pagespeed - 在哪里放置GoogleSite