diff --git a/appointment.spec b/appointment.spec index 928f9d5..0ef900d 100644 --- a/appointment.spec +++ b/appointment.spec @@ -52,4 +52,4 @@ import shutil shutil.copyfile('./appointment.json', '{0}/appointment.json'.format(DISTPATH)) shutil.copyfile('./contact_all.xlsx', '{0}/contact_all.xlsx'.format(DISTPATH)) shutil.copyfile('./config.ini', '{0}/config.ini'.format(DISTPATH)) -shutil.copytree('./venv\Lib/site-packages/grpc/_cython/_credentials', '{0}/appointment/grpc/_cython/_credentials'.format(DISTPATH)) \ No newline at end of file +shutil.copytree('./venv/site-packages/grpc/_cython/_credentials', '{0}/appointment/grpc/_cython/_credentials'.format(DISTPATH)) \ No newline at end of file diff --git a/logs/LogSender.py b/logs/LogSender.py index 477cf38..6e4f614 100644 --- a/logs/LogSender.py +++ b/logs/LogSender.py @@ -25,6 +25,7 @@ LOG_ERROR = "ERROR" LOG_TYPE_INFO = "INFO" LOG_ERROR_TYPE_DOUBLE_DATA = "DOUBLE_REQUEST_FOR_SAME_DATA" LOG_ERROR_TOO_MANY_REQUEST_TODAY = "TOO_MANY_REQUEST_TODAY" +LOG_ERROR_CAPTCHA_ERROR_MESSAGE = "CAPTCHA_ERROR" LOG_SUBJECT_ERROR = "ERROR" LOG_APPOINTMENT_ERROR = "APPOINTMENT_ERROR" LOG_APPOINTMENT_TIMEOUT = "TIMEOUT" @@ -78,6 +79,10 @@ class LogSender: error_msg = contact.mail self.send_log(msg=error_msg, type=LOG_ERROR_TOO_MANY_REQUEST_TODAY, subject=LOG_SUBJECT_ERROR) + def send_captcha_error(self, contact: ContactPojo): + error_msg = contact.mail + self.send_log(msg=error_msg, type=LOG_ERROR_CAPTCHA_ERROR_MESSAGE, subject=LOG_SUBJECT_ERROR) + def send_appoint_result(self, result: ReserveResultPojo): if result.type == PublishType.SUCCESS: # get id diff --git a/params.py b/params.py index 0f413bf..a5db2db 100644 --- a/params.py +++ b/params.py @@ -1,9 +1,6 @@ -import configparser import random import string -from playwright.sync_api import sync_playwright - from db.DbManager import DataManager from logs.LogSender import LogSender @@ -14,6 +11,7 @@ oracle_log_sender = LogSender() PROXY_SERVER = "http://gw.ntnt.io:5959" PROXY_PASSWORD = "94sY7zwBG13i" + def get_random_id_number_for_proxy() -> str: S = 8 # number of characters in the string. ran = ''.join(random.choices(string.digits, k=S)) @@ -21,6 +19,7 @@ def get_random_id_number_for_proxy() -> str: print("The randomly generated string is : " + str(ran)) # print the random data return id_number + DEVICES = ['iPad (gen 6)', 'iPad (gen 6) landscape', 'iPad (gen 7)', 'iPad (gen 7) landscape', 'iPad Mini', 'iPad Mini landscape', 'iPad Pro 11', 'iPad Pro 11 landscape', 'iPhone 6', 'iPhone 6 landscape', 'iPhone 6 Plus', 'iPhone 6 Plus landscape', 'iPhone 7', 'iPhone 7 landscape', 'iPhone 7 Plus', diff --git a/workers/commandor_page.py b/workers/commandor_page.py index 6196465..107c88a 100644 --- a/workers/commandor_page.py +++ b/workers/commandor_page.py @@ -25,6 +25,7 @@ MESSAGE_FIELD_CLASS = ".message" CONFIRMED_MESSAGE = "Your request for a Leather Goods appointment has been registered" DOUBLE_REQUEST_ERROR_MESSAGE = "A request with the same data has already been validated today." TOO_MANY_REQUEST_ERROR_MESSAGE = "Due to a large number of requests" +CAPTCHA_ERROR_MESSAGE = "Error verifying captcha, please try again" TIME_OUT = 400000 OTP_TIMEOUT = 240 @@ -220,6 +221,9 @@ class CommandorPage: # close browser time.sleep(2) self.browser.close() + elif CAPTCHA_ERROR_MESSAGE in erro_content: + # this email has been already used + params.oracle_log_sender.send_captcha_error(self.contact) def _set_email(self, email): time.sleep(get_random_wait_time())