need to get new cookies

This commit is contained in:
2024-03-15 13:09:05 +01:00
parent 2a748fe035
commit 7bf7a2642a
4 changed files with 288 additions and 3 deletions
+12 -2
View File
@@ -100,7 +100,8 @@ class AppointmentRequestSender(threading.Thread):
print(f" [x] Received {body}")
_message_count = self.cookiesPublisher.message_count()
print("message count in queue is {}".format(_message_count))
sender = Sender(body.decode("UTF-8"), cookiesPublisher=self.cookiesPublisher,
_received_cookies = body.decode("UTF-8")
sender = Sender(_received_cookies, cookiesPublisher=self.cookiesPublisher,
proxy_to_use=random.choice(self.proxy_to_use_list))
self.contact_list = filter_contacts(self.contact_list)
# remove already booked contacts
@@ -116,12 +117,21 @@ class AppointmentRequestSender(threading.Thread):
if self.valid_csrf is None:
self.valid_csrf = captchaResultGetter.get_csrf(proxy_to_use=random.choice(self.proxy_to_use_list),
cookie=body.decode("UTF-8"))
can_continue = sender.send_request(HERMES_REGISTER, con, csrf=self.valid_csrf)
_new_cookies = captchaResultGetter.get_valid_ch_cookie(sender.proxy_to_use,
old_valid_cookie=_received_cookies)
if _new_cookies is not None:
print("new cookie is " + _new_cookies)
sender.cookie_str = _new_cookies
can_continue = sender.send_request(HERMES_REGISTER, con, csrf=self.valid_csrf)
else:
can_continue = RequestResult.COOKIES_ERROR
if can_continue == RequestResult.BLOCKED:
print("cannot continue, valid_csrf is " + str(self.valid_csrf))
break
elif can_continue == RequestResult.PROXY_ERROR:
print("PROXY_ERROR, will not reset valid_csrf")
elif can_continue == RequestResult.COOKIES_ERROR:
print("COOKIES_ERROR, will not reset valid_csrf")
else:
print("can continue, will reset valid_csrf")
self.valid_csrf = None