Closed WenhaoYou1 closed 10 months ago
I also faced the same prob
I solved this problem by using requests. Here is my code:
api_endpoint = 'http://2captcha.com/in.php'
result_endpoint = 'http://2captcha.com/res.php'
payload = {
'method': 'userrecaptcha',
'googlekey': site_key,
'key': api_key,
'pageurl': pageurl,
'json': 1
}
response = requests.post(api_endpoint, data=payload)
response_data = response.json()
if response_data.get('status') == 1:
request_id = response_data.get('request')
time.sleep(20) #
result = requests.get(result_endpoint, params={
'key': api_key,
'action': 'get',
'id': request_id,
'json': 1
})
result_data = result.json()
I update both TwoCaptcha and 2captcha-python to the latest version. Show my code below: solver = TwoCaptcha(api_key) try: result = solver.recaptcha(sitekey=site_key, url=pageurl) print("Recaptcha Answer:", result['code'])
except Exception as e: print('Error:', e)
Thanks for your help.