peut prendre RDV automatiquement

This commit is contained in:
2022-02-21 15:58:33 +01:00
parent 28c8813606
commit eebb76eb2a
3 changed files with 14 additions and 6 deletions
BIN
View File
Binary file not shown.
+2 -1
View File
@@ -19,7 +19,8 @@ class ExcelReader:
last_name=last_name, last_name=last_name,
first_name=first_name, first_name=first_name,
ccid=contact_dict['ccid'], 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) contact_list.append(contact)
return contact_list return contact_list
+12 -5
View File
@@ -12,8 +12,9 @@ from pojo.serial_modem import SerialModem
from utils.logging import init_logger from utils.logging import init_logger
BAUDRATE = 115200 BAUDRATE = 115200
OTP_TIMEOUT = 120 OTP_TIMEOUT = 60
sms_received = False sms_received = False
commandor = Commandor()
def get_devices_ports() -> list: def get_devices_ports() -> list:
@@ -94,13 +95,17 @@ def start_to_handle_sms(serial_modem: SerialModem):
def handle_sms(sms): 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)) logger.info(
global sms_received u'== SMS message received ==\nFrom: {0}\nTime: {1}\nMessage:\n{2}\n'.format(sms.number, sms.time, sms.text))
sms_received = True
# extract the otp number # extract the otp number
logger.info("try to extract the otp") logger.info("try to extract the otp")
match = re.search(r'\d{6,8}', sms.text) 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: def init_modems() -> list:
@@ -125,5 +130,7 @@ if __name__ == '__main__':
# create modems for all the available port # create modems for all the available port
modem_list = init_modems() modem_list = init_modems()
# create listeners for chaque modem # create listeners for chaque modem
for modem in modem_list: for modem in modem_list:
commandor.start_page(modem.contact)
start_to_handle_sms(modem) start_to_handle_sms(modem)