Trying to automate website with recaptcha-V3 on python requests

62 views Asked by At

I'm trying to create an automated process for a small website: https://artio.faucet.berachain.com/. The task is to enter a wallet address, solve a captcha and send a POST request with the wallet address. Based on what I've seen in the developer console of the browser, when the button is clicked, it activates the captcha. Then, it sends the response from the captcha as a POST request and the inputted wallet address. At the moment, I solve the captcha and insert the solution in the "Authorization" header. However, I receive a 401 Error with a body that indicates the site is currently overloaded. Also, if I send an incorrect captcha solution, I still get a 401 Error, but with a body indicating the solution is invalid. I suspect there is a small detail missing, such as a cookie or header. I would appreciate your assistance in finding this detail. The script code is attached for your reference:

import requests
import fake_useragent
import browser_cookie3
from pypasser import reCaptchaV3

cookies = browser_cookie3.firefox(domain_name='.google.com')
session = requests.Session()
session.cookies.update(cookies)

user = fake_useragent.UserAgent().random

headers = {
    "User-Agent": user,
    "Accept": "*/*"
    }

reCaptcha_response = reCaptchaV3('https://www.google.com/recaptcha/api2/anchor?ar=1&k=6LfOA04pAAAAAL9ttkwIz40hC63_7IsaU2MgcwVH&co=aHR0cHM6Ly9hcnRpby5mYXVjZXQuYmVyYWNoYWluLmNvbTo0NDM.&hl=ru&v=QUpyTKFkX5CIV6EF8TFSWEif&size=invisible&cb=4q2uccrncqhj')

headers_auth = {
    "Host":"artio-80085-faucet-api-recaptcha.berachain.com",
    "User-Agent": user,
    "Accept": "*/*",
    "Accept-Language":"ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3",
    "Accept-Encoding":"gzip,deflate,br",
    "Authorization": "Bearer " + reCaptcha_response,
    "Referer": "https://artio.faucet.berachain.com/",
    "Origin": "https://artio.faucet.berachain.com",
    "Content-Type": "text/plain;charset=UTF-8",
    "Content-Length":'56',
    "Connection": 'keep-alive',
    "Sec-Fetch-Dest":'empty',
    "Sec-Fetch-Mode":'cors',
    "Sec-Fetch-Site":'same-site',
    "TE": 'trailers'
}

data = {
    "address": "0x2b9f678babd67f6622dc6f9811111f90dbeae5d1"
}

claim = session.post('https://artio-80085-faucet-api-recaptcha.berachain.com/api/claim', data=data, headers=headers_auth)
print(claim.text)
print(claim.status_code)

At the moment, I solve the captcha and insert the solution in the "Authorization" header. However, I receive a 401 Error with a body that indicates the site is currently overloaded.

0

There are 0 answers