File size: 823 Bytes
d498971 733a08d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import requests
import time
import os
TURNSTILE_SOLVER_URL = os.environ.get("TURNSTILE_SOLVER_URL", "http://127.0.0.1:5000")
def getTaskId():
url = f"{TURNSTILE_SOLVER_URL}/turnstile?url=https://tenbin.ai/workspace&sitekey=0x4AAAAAABGR2exxRproizri&action=issue_execution_token"
response = requests.get(url)
response.raise_for_status()
return response.json()['task_id']
def getCaptcha(task_id):
url = f"{TURNSTILE_SOLVER_URL}/result?id={task_id}"
while True:
try:
response = requests.get(url)
response.raise_for_status()
captcha = response.json().get('value', None)
if captcha:
return captcha
else:
time.sleep(1)
except Exception as e:
print(e)
time.sleep(1) |