can restart modemPool and detected disabled sim card

This commit is contained in:
2022-02-24 17:17:39 +01:00
parent eebb76eb2a
commit 34dbe1d909
17 changed files with 382 additions and 49 deletions
+39
View File
@@ -0,0 +1,39 @@
import json
import pandas as pandas
from pojo.contact_pojo import ContactPojo
class ExcelHelper:
def __init__(self):
self._df = pandas.Series()
def write_phone(self, phone_number):
new_df = pandas.Series([phone_number])
self._df = pandas.concat([self._df, new_df])
self._df.to_excel("phone_list.xlsx")
# read the contact list from the exel file
def read_contacts(self) -> list:
contact_list_in_json = pandas.read_excel(r'./contact.xlsx').to_json(orient='records')
contact_dict_list = json.loads(contact_list_in_json)
contact_list = []
for contact_dict in contact_dict_list:
name = contact_dict['name'].split(' ')
first_name = name[0]
last_name = name[-1]
contact = ContactPojo(phone_number=contact_dict['phone'],
last_name=last_name,
first_name=first_name,
ccid=contact_dict['ccid'],
passport_number=contact_dict['passport'],
mail=contact_dict['email'])
contact_list.append(contact)
return contact_list
if __name__ == '__main__':
helper = ExcelHelper()
helper.write_phone("88649614591")
+1 -1
View File
@@ -2,7 +2,7 @@ import logging
def init_logger():
logging.basicConfig(filename="scrapy.log",
logging.basicConfig(filename="appointment.log",
filemode='a',
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%D:%H:%M:%S',
+27
View File
@@ -0,0 +1,27 @@
import logging
import threading
from datetime import datetime
import pika
APPOINTMENT_QUEUE = "APPOINTMENT_QUEUE"
class MessageReceiver:
def __init__(self):
self._credentials = pika.PlainCredentials('scrapy_rabbitmq', '4x!hReCbA5v3heKWfPJV-Y')
def start_listener(self, callback):
t = threading.Thread(target=self._run, args=(callback,))
t.start()
def _run(self, callback):
connection = pika.BlockingConnection(
pika.ConnectionParameters(host='rabbitmq.lpaconsulting.fr', port=6672, credentials=self._credentials))
channel = connection.channel()
channel.queue_declare(queue=APPOINTMENT_QUEUE)
channel.basic_consume(queue=APPOINTMENT_QUEUE,
auto_ack=True,
on_message_callback=callback)
print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()
Binary file not shown.