add new filter to sms
This commit is contained in:
@@ -110,22 +110,25 @@ def handle_sms(sms):
|
||||
date = str(sms.time)[0:10]
|
||||
if date == str(datetime.date.today()):
|
||||
logger.info("this sms is for today")
|
||||
logger.info("try to extract the otp")
|
||||
pattern = r'\d{6,8}'
|
||||
# if re.match(pattern, sms.text):
|
||||
match = re.search(pattern, sms.text)
|
||||
otp = match.group(0)
|
||||
logger.info("otp is " + otp)
|
||||
commandor.send_otp(otp)
|
||||
# wait for the sms for 20 seconds
|
||||
global is_finished
|
||||
while not is_finished:
|
||||
time.sleep(2)
|
||||
is_finished = True
|
||||
global current_gsm_modem
|
||||
if current_gsm_modem:
|
||||
logger.info("will close used modem")
|
||||
current_gsm_modem.close()
|
||||
if "rendez-vous" in sms.text:
|
||||
logger.info("try to extract the otp")
|
||||
pattern = r'\d{6,8}'
|
||||
# if re.match(pattern, sms.text):
|
||||
match = re.search(pattern, sms.text)
|
||||
otp = match.group(0)
|
||||
logger.info("otp is " + otp)
|
||||
commandor.send_otp(otp)
|
||||
# wait for the sms for 20 seconds
|
||||
global is_finished
|
||||
while not is_finished:
|
||||
time.sleep(2)
|
||||
is_finished = True
|
||||
global current_gsm_modem
|
||||
if current_gsm_modem:
|
||||
logger.info("will close used modem")
|
||||
current_gsm_modem.close()
|
||||
else:
|
||||
logger.info("the sms is not for RDV")
|
||||
else:
|
||||
logger.info("the sms is not for today")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user