- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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 24.08.2020 19:10 # 0
Fike 24.08.2020 21:04 # 0
gost 24.08.2020 19:13 # 0
gost 24.08.2020 19:14 # 0