add result_pojo.py
This commit is contained in:
+5
-3
@@ -8,10 +8,10 @@ import pika
|
||||
|
||||
from db.mongo_manager import MONGO_STORE_MANAGER
|
||||
from models.contact_pojo import ContactPojo
|
||||
from models.result_pojo import RequestResult
|
||||
from queue_message.CookiesPublisher import CookiesPublisher
|
||||
from utiles import is_time_between
|
||||
from workers.captcha_result_getter import CaptchaResultGetter, HERMES_REGISTER
|
||||
from workers.proxies_constants import PROXY_LIST_DE
|
||||
from workers.sender import Sender
|
||||
|
||||
QUEUE_HOST = "appointment.lpaconsulting.fr"
|
||||
@@ -73,7 +73,7 @@ def is_open():
|
||||
return is_time_between(datetime.time(10, 30), datetime.time(19, 00))
|
||||
|
||||
|
||||
class AppointmentRequestSendor(threading.Thread):
|
||||
class AppointmentRequestSender(threading.Thread):
|
||||
def __init__(self, sub_contact_list: list, proxy_to_use_list, cookiesPublisher: CookiesPublisher,
|
||||
queue_name=REQUEST_DATA_QUEUE):
|
||||
super().__init__()
|
||||
@@ -117,9 +117,11 @@ class AppointmentRequestSendor(threading.Thread):
|
||||
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)
|
||||
if not can_continue:
|
||||
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")
|
||||
else:
|
||||
print("can continue, will reset valid_csrf")
|
||||
self.valid_csrf = None
|
||||
Reference in New Issue
Block a user