optimize imports
This commit is contained in:
+1
-1
@@ -52,4 +52,4 @@ import shutil
|
|||||||
shutil.copyfile('./appointment.json', '{0}/appointment.json'.format(DISTPATH))
|
shutil.copyfile('./appointment.json', '{0}/appointment.json'.format(DISTPATH))
|
||||||
shutil.copyfile('./contact_all.xlsx', '{0}/contact_all.xlsx'.format(DISTPATH))
|
shutil.copyfile('./contact_all.xlsx', '{0}/contact_all.xlsx'.format(DISTPATH))
|
||||||
shutil.copyfile('./config.ini', '{0}/config.ini'.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))
|
shutil.copytree('./venv/site-packages/grpc/_cython/_credentials', '{0}/appointment/grpc/_cython/_credentials'.format(DISTPATH))
|
||||||
@@ -25,6 +25,7 @@ LOG_ERROR = "ERROR"
|
|||||||
LOG_TYPE_INFO = "INFO"
|
LOG_TYPE_INFO = "INFO"
|
||||||
LOG_ERROR_TYPE_DOUBLE_DATA = "DOUBLE_REQUEST_FOR_SAME_DATA"
|
LOG_ERROR_TYPE_DOUBLE_DATA = "DOUBLE_REQUEST_FOR_SAME_DATA"
|
||||||
LOG_ERROR_TOO_MANY_REQUEST_TODAY = "TOO_MANY_REQUEST_TODAY"
|
LOG_ERROR_TOO_MANY_REQUEST_TODAY = "TOO_MANY_REQUEST_TODAY"
|
||||||
|
LOG_ERROR_CAPTCHA_ERROR_MESSAGE = "CAPTCHA_ERROR"
|
||||||
LOG_SUBJECT_ERROR = "ERROR"
|
LOG_SUBJECT_ERROR = "ERROR"
|
||||||
LOG_APPOINTMENT_ERROR = "APPOINTMENT_ERROR"
|
LOG_APPOINTMENT_ERROR = "APPOINTMENT_ERROR"
|
||||||
LOG_APPOINTMENT_TIMEOUT = "TIMEOUT"
|
LOG_APPOINTMENT_TIMEOUT = "TIMEOUT"
|
||||||
@@ -78,6 +79,10 @@ class LogSender:
|
|||||||
error_msg = contact.mail
|
error_msg = contact.mail
|
||||||
self.send_log(msg=error_msg, type=LOG_ERROR_TOO_MANY_REQUEST_TODAY, subject=LOG_SUBJECT_ERROR)
|
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):
|
def send_appoint_result(self, result: ReserveResultPojo):
|
||||||
if result.type == PublishType.SUCCESS:
|
if result.type == PublishType.SUCCESS:
|
||||||
# get id
|
# get id
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import configparser
|
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
|
||||||
from playwright.sync_api import sync_playwright
|
|
||||||
|
|
||||||
from db.DbManager import DataManager
|
from db.DbManager import DataManager
|
||||||
from logs.LogSender import LogSender
|
from logs.LogSender import LogSender
|
||||||
|
|
||||||
@@ -14,6 +11,7 @@ oracle_log_sender = LogSender()
|
|||||||
PROXY_SERVER = "http://gw.ntnt.io:5959"
|
PROXY_SERVER = "http://gw.ntnt.io:5959"
|
||||||
PROXY_PASSWORD = "94sY7zwBG13i"
|
PROXY_PASSWORD = "94sY7zwBG13i"
|
||||||
|
|
||||||
|
|
||||||
def get_random_id_number_for_proxy() -> str:
|
def get_random_id_number_for_proxy() -> str:
|
||||||
S = 8 # number of characters in the string.
|
S = 8 # number of characters in the string.
|
||||||
ran = ''.join(random.choices(string.digits, k=S))
|
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
|
print("The randomly generated string is : " + str(ran)) # print the random data
|
||||||
return id_number
|
return id_number
|
||||||
|
|
||||||
|
|
||||||
DEVICES = ['iPad (gen 6)', 'iPad (gen 6) landscape', 'iPad (gen 7)', 'iPad (gen 7) landscape', 'iPad Mini',
|
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',
|
'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',
|
'iPhone 6 Plus', 'iPhone 6 Plus landscape', 'iPhone 7', 'iPhone 7 landscape', 'iPhone 7 Plus',
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ MESSAGE_FIELD_CLASS = ".message"
|
|||||||
CONFIRMED_MESSAGE = "Your request for a Leather Goods appointment has been registered"
|
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."
|
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"
|
TOO_MANY_REQUEST_ERROR_MESSAGE = "Due to a large number of requests"
|
||||||
|
CAPTCHA_ERROR_MESSAGE = "Error verifying captcha, please try again"
|
||||||
TIME_OUT = 400000
|
TIME_OUT = 400000
|
||||||
OTP_TIMEOUT = 240
|
OTP_TIMEOUT = 240
|
||||||
|
|
||||||
@@ -220,6 +221,9 @@ class CommandorPage:
|
|||||||
# close browser
|
# close browser
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
self.browser.close()
|
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):
|
def _set_email(self, email):
|
||||||
time.sleep(get_random_wait_time())
|
time.sleep(get_random_wait_time())
|
||||||
|
|||||||
Reference in New Issue
Block a user