diff --git a/contact.xlsx b/contact.xlsx index e7945f0..83ac842 100644 Binary files a/contact.xlsx and b/contact.xlsx differ diff --git a/excel_reader.py b/excel_reader.py index 6523461..65996d3 100644 --- a/excel_reader.py +++ b/excel_reader.py @@ -19,7 +19,8 @@ class ExcelReader: last_name=last_name, first_name=first_name, ccid=contact_dict['ccid'], - passport_number=contact_dict['passport'], mail=contact_dict['email']) + passport_number=contact_dict['passport'], + mail=contact_dict['email']) contact_list.append(contact) return contact_list diff --git a/main.py b/main.py index 5f597ab..bb0acf7 100644 --- a/main.py +++ b/main.py @@ -12,8 +12,9 @@ from pojo.serial_modem import SerialModem from utils.logging import init_logger BAUDRATE = 115200 -OTP_TIMEOUT = 120 +OTP_TIMEOUT = 60 sms_received = False +commandor = Commandor() def get_devices_ports() -> list: @@ -94,13 +95,17 @@ def start_to_handle_sms(serial_modem: SerialModem): def handle_sms(sms): - logger.info(u'== SMS message received ==\nFrom: {0}\nTime: {1}\nMessage:\n{2}\n'.format(sms.number, sms.time, sms.text)) - global sms_received - sms_received = True + logger.info( + u'== SMS message received ==\nFrom: {0}\nTime: {1}\nMessage:\n{2}\n'.format(sms.number, sms.time, sms.text)) # extract the otp number logger.info("try to extract the otp") match = re.search(r'\d{6,8}', sms.text) - logger.info("otp is " + match.group(0)) + otp = match.group(0) + logger.info("otp is " + otp) + commandor.send_otp(otp) + time.sleep(20) + global sms_received + sms_received = True def init_modems() -> list: @@ -125,5 +130,7 @@ if __name__ == '__main__': # create modems for all the available port modem_list = init_modems() # create listeners for chaque modem + for modem in modem_list: + commandor.start_page(modem.contact) start_to_handle_sms(modem)