updated captcha logic

This commit is contained in:
msramalho
2022-06-21 12:59:45 +02:00
parent a09cf32b3e
commit cf100ee69e

View File

@@ -35,10 +35,11 @@ def captcha_handler(captcha):
for wait in 24 * [5]: # tries every 5s for 2min
print(f"sending request to {url=}", flush=True)
r = requests.get(url)
print(f"got response {r.text=}", flush=True)
if key := regex_string.search(r.text):
print(f"got captcha result {key=}", flush=True)
return captcha.try_again(key[0])
if r.status_code == 200:
print(f"got response {r.text=}", flush=True)
if key := regex_string.search(r.text):
print(f"got captcha result {key=}", flush=True)
return captcha.try_again(key[0])
print(f"sleeping {wait} seconds", flush=True)
time.sleep(wait)
else: