use listener instead of rabittmq
This commit is contained in:
+5
-8
@@ -29,8 +29,9 @@ class CommandorPage:
|
||||
def __init__(self):
|
||||
self.otp_value = None
|
||||
|
||||
def _run(self, e: threading.Event, proxy, contact: ContactPojo, on_ready_for_otp):
|
||||
def _run(self, e: threading.Event, proxy, contact: ContactPojo, on_ready_for_otp, on_success):
|
||||
self.contact = contact
|
||||
self.on_success_listener = on_success
|
||||
with sync_playwright() as pwright:
|
||||
firefox_user_agents = filter(lambda user_agent: "firefox" in user_agent.lower(), user_agent_list)
|
||||
firefox_user_agents_list = list(firefox_user_agents)
|
||||
@@ -75,9 +76,9 @@ class CommandorPage:
|
||||
time.sleep(2)
|
||||
# check and send successful event
|
||||
|
||||
def start_page(self, proxy, contact: ContactPojo, on_ready_for_otp) -> threading.Event:
|
||||
def start_page(self, proxy, contact: ContactPojo, on_ready_for_otp, on_sucess) -> threading.Event:
|
||||
e = threading.Event()
|
||||
t = threading.Thread(target=self._run, args=(e, proxy, contact, on_ready_for_otp))
|
||||
t = threading.Thread(target=self._run, args=(e, proxy, contact, on_ready_for_otp, on_sucess))
|
||||
t.start()
|
||||
return e
|
||||
|
||||
@@ -137,11 +138,7 @@ class CommandorPage:
|
||||
firstName=contact.first_name, lastName=contact.last_name, email=contact.mail,
|
||||
passport=contact.passport, ccid=contact.ccid)
|
||||
result.id = id
|
||||
channel = params.rabittmq_connection.channel()
|
||||
# default exchange, for 'hello' queue
|
||||
print("will publish message:" + result.to_json())
|
||||
channel.basic_publish(exchange='', routing_key=APPOINTMENT_QUEUE,
|
||||
body=result.to_json())
|
||||
self.on_success_listener(result)
|
||||
|
||||
|
||||
def get_random_id_number_for_proxy() -> str:
|
||||
|
||||
Reference in New Issue
Block a user