TOKEN, EMAIL, PASS - на свои значения. Код рабочий, проверено
#!!! pip3 install 2captcha-python
import requests
from bs4 import BeautifulSoup
from twocaptcha import TwoCaptcha
def get_content(html):
soup = BeautifulSoup(html, 'html.parser')
item = soup.find('input', attrs={'name': '_csrf_token'})
csrf = item['value']
return csrf
solver = TwoCaptcha('TOKEN')
g_recaptcha = ''
try:
result = solver.recaptcha(
sitekey='6LftX68ZAAAAAOvXzEPz4lx9jgzfHdU3uVj-ptKT',
url='https://3ddd.ru/login',
invisible=1)
except Exception as e:
exit(e)
else:
g_recaptcha = result['code']
header = {
# 'user-agent': user
}
url = 'https://3ddd.ru/login'
url_form = 'https://3ddd.ru/login_check'
loging = requests.get(url, headers=header)
loging_cookies = loging.cookies
login_csrf = get_content(loging.text)
datas = {
'_username': 'EMAIL',
'_password': 'PASS',
'_csrf_token': login_csrf,
'g-recaptcha-response': g_recaptcha,
}
loging2 = requests.post(url_form, data=datas, headers=header, cookies=loging_cookies)
print(loging2.text)