如何使用验证码提交表格

时间:2019-02-18 15:12:58

标签: python python-requests

我正在尝试在亚马逊网站上完成验证码。但是在提交表单时会得到<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

0 个答案:

没有答案