diff --git a/contact.xlsx b/contact.xlsx index 5e2d70a..04e9129 100644 Binary files a/contact.xlsx and b/contact.xlsx differ diff --git a/export_valid_profiles.py b/export_valid_profiles.py index b1d622a..6ec7e9e 100644 --- a/export_valid_profiles.py +++ b/export_valid_profiles.py @@ -38,8 +38,6 @@ def write_the_valid_profiles_to_excel(): mail=reserve_pojo.email, position=0) seed = 8 # number of characters in the string. # call random.choices() string module to find the string in Uppercase + numeric data. - ran = ''.join(random.choices(string.digits, k=seed)) - contact.mail = "{}_{}{}@163.com".format(contact.first_name, contact.last_name, ran) # contact.passport = get_random_id_number() # if contact.passport == None or len(contact.passport) == 0: # old_contact = [item for item in exist_contacts if item.mail == contact.mail] diff --git a/main.py b/main.py index d6945e8..80cb54e 100644 --- a/main.py +++ b/main.py @@ -18,6 +18,7 @@ from pojo.ReserveResultPojo import ReserveResultPojo from pojo.serial_modem import SerialModem from utils.excel_reader import ExcelHelper from utils.message_receiver import MessageReceiver +from utils.operator import check_operator, Operator OTP_TIMEOUT = 180 is_finished = False @@ -68,7 +69,9 @@ def timeout_occurred(serial_modem: SerialModem): def start_to_handle_sms(serial_modem: SerialModem): global current_gsm_modem current_gsm_modem = serial_modem.modem - # current_gsm_modem.deleteMultipleStoredSms(memory="SM") + if check_operator(serial_modem.ccid) == Operator.LYCAMOBILE: + # lycamobile + current_gsm_modem.deleteMultipleStoredSms(memory="SM") serial_modem.modem.smsReceivedCallback = handle_sms global is_finished is_finished = False diff --git a/utils/operator.py b/utils/operator.py new file mode 100644 index 0000000..9f9e0fe --- /dev/null +++ b/utils/operator.py @@ -0,0 +1,15 @@ +from enum import Enum + + +class Operator(Enum): + SFR = "SFR" + LYCAMOBILE = "LYCAMOBILE" + CHINA_TELECOM = "CHINA_TELECOM" + + +def check_operator(ccid: str) -> Operator: + if "893313" in ccid: + return Operator.LYCAMOBILE + elif "893310" in ccid: + return Operator.SFR + return Operator.CHINA_TELECOM diff --git a/utils/utils.py b/utils/utils.py new file mode 100644 index 0000000..e69de29 diff --git a/wait_for_sms.py b/wait_for_sms.py index 188d667..bc148ef 100644 --- a/wait_for_sms.py +++ b/wait_for_sms.py @@ -13,6 +13,7 @@ from modems.card_pool import CardPool from params import MODEM_POOL_PORTS, CARD_POOL_PORT from pojo.serial_modem import SerialModem from utils.excel_reader import ExcelHelper +from utils.operator import check_operator, Operator OTP_TIMEOUT = 40 commandor = CommandorPage() @@ -48,7 +49,7 @@ def timeout_occurred(serial_modem: SerialModem): def start_to_handle_sms(serial_modem: SerialModem): global current_gsm_modem current_gsm_modem = serial_modem.modem - if "893313" in serial_modem.ccid: + if check_operator(serial_modem.ccid) == Operator.LYCAMOBILE: # lycamobile current_gsm_modem.deleteMultipleStoredSms(memory="SM") serial_modem.modem.smsReceivedCallback = handle_sms @@ -94,7 +95,7 @@ def start_book(): modem_pool.reset_all_modems() modem_list = init_modems() # create listeners for chaque modem - # read the contact, and contact the 2 objects together + # read the contact, and merge the 2 objects together excel_reader = ExcelHelper() contacts = excel_reader.read_contacts() global current_sim_position