read mail after request
This commit is contained in:
@@ -70,6 +70,7 @@ class AppointmentRequestSender(threading.Thread):
|
|||||||
self.contact_list = sub_contact_list
|
self.contact_list = sub_contact_list
|
||||||
self.queue_name = queue_name
|
self.queue_name = queue_name
|
||||||
self.proxy_to_use_list = proxy_to_use_list
|
self.proxy_to_use_list = proxy_to_use_list
|
||||||
|
self.already_read_emails = False
|
||||||
|
|
||||||
def set_up_connection(self):
|
def set_up_connection(self):
|
||||||
self.connection = pika.BlockingConnection(
|
self.connection = pika.BlockingConnection(
|
||||||
@@ -193,6 +194,7 @@ class AppointmentRequestSender(threading.Thread):
|
|||||||
self.channel.start_consuming()
|
self.channel.start_consuming()
|
||||||
|
|
||||||
def retreive_invalidate_urls(self):
|
def retreive_invalidate_urls(self):
|
||||||
|
if not self.already_read_emails:
|
||||||
self.logger.info("will retreive_invalidate_urls")
|
self.logger.info("will retreive_invalidate_urls")
|
||||||
_mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
_mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
||||||
_mail_list_filtred = []
|
_mail_list_filtred = []
|
||||||
@@ -202,3 +204,6 @@ class AppointmentRequestSender(threading.Thread):
|
|||||||
_mail_list_filtred.append(mail)
|
_mail_list_filtred.append(mail)
|
||||||
self.logger.info("will call find_links_to_validate_from_mail_list, size = " + str(len(_mail_list_filtred)))
|
self.logger.info("will call find_links_to_validate_from_mail_list, size = " + str(len(_mail_list_filtred)))
|
||||||
find_links_to_validate_from_mail_list(_mail_list_filtred)
|
find_links_to_validate_from_mail_list(_mail_list_filtred)
|
||||||
|
self.already_read_emails = True
|
||||||
|
else:
|
||||||
|
self.logger.info("already read emails, will not retreive_invalidate_urls")
|
||||||
|
|||||||
+2
-2
@@ -64,10 +64,10 @@ def send_appointment_request(message_queue_name, _contact_list):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
contacts_file_path = '~/Desktop/contact_list_2024-03-20.xlsx'
|
contacts_file_path = '~/Desktop/contact_list_2024-03-19.xlsx'
|
||||||
_contact_list = read_contacts(contacts_file_path)
|
_contact_list = read_contacts(contacts_file_path)
|
||||||
_contact_list_to_book = filter_contacts(_contact_list)
|
_contact_list_to_book = filter_contacts(_contact_list)
|
||||||
_segment_number = 2
|
_segment_number = 1
|
||||||
logger.info("{} contacts to book".format(len(_contact_list_to_book)))
|
logger.info("{} contacts to book".format(len(_contact_list_to_book)))
|
||||||
last_thread = None
|
last_thread = None
|
||||||
for i in range(0, _segment_number):
|
for i in range(0, _segment_number):
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ class Sender:
|
|||||||
self.logger.info("body in json:{}".format(json.dumps(self.received_dict)))
|
self.logger.info("body in json:{}".format(json.dumps(self.received_dict)))
|
||||||
self.cookiesPublisher.publish_body(json.dumps(self.received_dict))
|
self.cookiesPublisher.publish_body(json.dumps(self.received_dict))
|
||||||
# self.cookie_str = new_coolies_str
|
# self.cookie_str = new_coolies_str
|
||||||
|
self.logger.info("successful request, mail:{}".format(contact.mail))
|
||||||
return RequestResult.SUCCESS
|
return RequestResult.SUCCESS
|
||||||
else:
|
else:
|
||||||
print(response.text)
|
print(response.text)
|
||||||
|
|||||||
Reference in New Issue
Block a user