- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
# TODO: fix this shit
def publish(self, session: requests.Session, auth_cookie: str, max_retries: int, retry_time: float) -> bool:
for i in range(max_retries):
L.info(f'PostForm.publish(), loading attempt #{i + 1}')
if self.load_new(session, auth_cookie):
break
time.sleep(retry_time)
else: # No break
L.error('PostForm.publish(): could not load the form')
return False
for i in range(max_retries):
L.info(f'PostForm.publish(), posting attempt #{i + 1}')
if not self.try_recognize_captcha(session):
time.sleep(retry_time)
continue # Load an another captcha with the same csrf/captcha_id
if self.try_post(session, auth_cookie) == PostForm.Status.POST_DONE:
return True
time.sleep(retry_time)
L.error(f'PostForm.publish() failed, max_retries exceeded')
return False
gost # 0
Fike # 0 ⇈
gost # 0
gost # 0 ⇈