add requirements.txt
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import playwright
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
from db.DbManager import DataManager
|
||||
from pojo.ReserveResultPojo import ReserveResultPojo
|
||||
|
||||
|
||||
# check result with playright
|
||||
def check_result_page(url):
|
||||
with sync_playwright() as p:
|
||||
run(p, url)
|
||||
|
||||
|
||||
def run(playwright, url):
|
||||
pixel_2 = playwright.devices['Pixel 2']
|
||||
browser = playwright.webkit.launch(headless=False)
|
||||
page = browser.new_page()
|
||||
url_to_check = url.replace("register/", "")
|
||||
print(url_to_check)
|
||||
page.goto(url_to_check)
|
||||
print(page.title())
|
||||
print(page.content())
|
||||
browser.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# get the list
|
||||
db_manager = DataManager()
|
||||
for appointment in db_manager.get_all_successful_items():
|
||||
result = ReserveResultPojo.from_firestore_dict(appointment.to_dict())
|
||||
check_result_page(result.url)
|
||||
print(result)
|
||||
+2
-2
@@ -32,6 +32,6 @@ class Commandor:
|
||||
|
||||
if __name__ == '__main__':
|
||||
commandor = Commandor()
|
||||
# contact = ContactPojo("0649614591", "EE6045381", "TANG", "Wenqian", "AZEER", "clench_groom02@icloud.com")
|
||||
# contact = ContactPojo("0649614591", "E24183897", "LIU", "Yusi", "AZEER", "lei-pan@outlook.com")
|
||||
# commandor.start_page(contact)
|
||||
commandor.send_otp("918116")
|
||||
commandor.send_otp("262353")
|
||||
|
||||
@@ -20,6 +20,10 @@ class DataManager:
|
||||
def get_all_error_items(self):
|
||||
pass
|
||||
|
||||
def get_all_successful_items(self):
|
||||
doc_ref = self._db.collection(u'2022-02-24')
|
||||
return doc_ref.stream()
|
||||
|
||||
def save(self, result: ReserveResultPojo):
|
||||
if result.type == PublishType.SUCCESS:
|
||||
# get id
|
||||
|
||||
@@ -189,8 +189,8 @@ if __name__ == '__main__':
|
||||
init_logger()
|
||||
logger = logging.getLogger()
|
||||
logger.addHandler(logging.StreamHandler(stream=sys.stdout))
|
||||
read_all_the_phone_number()
|
||||
# start_listen()
|
||||
# read_all_the_phone_number()
|
||||
start_listen()
|
||||
# reset the sim card pool
|
||||
# send_command("AT+SWIT01-0001\r", ser)
|
||||
|
||||
|
||||
@@ -15,14 +15,36 @@ class ReserveResultPojo:
|
||||
phone: str
|
||||
message: str
|
||||
url: str
|
||||
firstName: None
|
||||
lastName: None
|
||||
email: None
|
||||
id = None
|
||||
|
||||
@staticmethod
|
||||
def from_firestore_dict(source):
|
||||
publish_type = source['type']
|
||||
phone = source['phone']
|
||||
message = source['message']
|
||||
url = source['url']
|
||||
id = source['id']
|
||||
email = source['email']
|
||||
lastName = source['lastName']
|
||||
firstName = source['firstName']
|
||||
result = ReserveResultPojo(type=publish_type, phone=phone,
|
||||
message=message, url=url, email=email,
|
||||
firstName=firstName, lastName=lastName)
|
||||
result.id = id
|
||||
return result
|
||||
|
||||
def to_firestore_dict(self):
|
||||
dest = {
|
||||
u'type': self.type.value,
|
||||
u'id': self.id,
|
||||
u'message': self.message,
|
||||
u'phone': self.phone,
|
||||
u'firstName': self.firstName,
|
||||
u'lastName': self.lastName,
|
||||
u'email': self.email,
|
||||
u'url': self.url
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
dataclasses_json==0.5.6
|
||||
firebase_admin==5.2.0
|
||||
pandas==1.4.1
|
||||
pika==1.2.0
|
||||
playwright==1.19.0
|
||||
pyserial==3.5
|
||||
python_gsmmodem_new==0.13.0
|
||||
Reference in New Issue
Block a user