diff --git a/.gitignore b/.gitignore index b36ba63..ed351c5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ out lib appointment_*.log ./build +./dist diff --git a/appointment.spec b/appointment.spec index a23460d..928f9d5 100644 --- a/appointment.spec +++ b/appointment.spec @@ -49,7 +49,7 @@ coll = COLLECT( name='appointment', ) import shutil -shutil.copyfile('C:\\Users\\landd\\IdeaProjects\\appointment_tool\\appointment.json', '{0}/appointment.json'.format(DISTPATH)) -shutil.copyfile('C:\\Users\\landd\\IdeaProjects\\appointment_tool\\contact_all.xlsx', '{0}/contact_all.xlsx'.format(DISTPATH)) -shutil.copyfile('.\config.ini', '{0}/config.ini'.format(DISTPATH)) +shutil.copyfile('./appointment.json', '{0}/appointment.json'.format(DISTPATH)) +shutil.copyfile('./contact_all.xlsx', '{0}/contact_all.xlsx'.format(DISTPATH)) +shutil.copyfile('./config.ini', '{0}/config.ini'.format(DISTPATH)) shutil.copytree('./venv\Lib/site-packages/grpc/_cython/_credentials', '{0}/appointment/grpc/_cython/_credentials'.format(DISTPATH)) \ No newline at end of file diff --git a/appointment_mac.spec b/appointment_mac.spec new file mode 100644 index 0000000..ddb9e2c --- /dev/null +++ b/appointment_mac.spec @@ -0,0 +1,55 @@ +# -*- mode: python ; coding: utf-8 -*- + + +block_cipher = None + + +a = Analysis( + ['appointment.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False, +) +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) + +exe = EXE( + pyz, + a.scripts, + [], + exclude_binaries=True, + name='appointment', + debug=True, + bootloader_ignore_signals=False, + strip=False, + upx=False, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) +coll = COLLECT( + exe, + a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=True, + upx_exclude=[], + name='appointment', +) +import shutil +shutil.copyfile('./appointment.json', '{0}/appointment.json'.format(DISTPATH)) +shutil.copyfile('./contact_all.xlsx', '{0}/contact_all.xlsx'.format(DISTPATH)) +shutil.copyfile('./config.ini', '{0}/config.ini'.format(DISTPATH)) +shutil.copytree('./venv/lib/python3.8/site-packages/grpc/_cython/_credentials', '{0}/appointment/grpc/_cython/_credentials'.format(DISTPATH)) \ No newline at end of file diff --git a/check_results.py b/check_results.py index efdc2b8..dc5feee 100644 --- a/check_results.py +++ b/check_results.py @@ -10,7 +10,7 @@ from playwright.sync_api import sync_playwright import params from workers.commandor_page import get_random_id_number_for_proxy from logs.LogSender import TYPE_EVENT_CHECK_RESULTS, LOG_SUBJECT_EVENT -from pojo.ReserveResultPojo import ReserveResultPojo +from pojo.ReserveResultPojo import ReserveResultPojo, PublishType SORRY_SENTENCE = "nous sommes sincèrement désolés de n'avoir pu vous satisfaire cette fois-ci" PENDING_SENTENCE = "Ce soir, entre 20:00 et 20:30, vous obtiendrez une réponse par e-mail." @@ -106,13 +106,18 @@ if __name__ == '__main__': db_manager = params.firebase_store_manager collection = db_manager.get_all_successful_items() count = 0 - task_list = list() + result_pojo = ReserveResultPojo(type=PublishType.SUCCESS, phone="0649614591", email="panleicim@gmail.com", + message="SUCCESS", firstName="Lei", lastName="PAN") + result_list = [] + for appointment in collection.stream(): + reserve_pojo = ReserveResultPojo.from_firestore_dict(appointment.to_dict()) + result_list.append(result_pojo) + with ThreadPoolExecutor(max_workers=2) as executor: - for appointment in collection.stream(): + for reserve in result_list: count = count + 1 - reserve_pojo = ReserveResultPojo.from_firestore_dict(appointment.to_dict()) - if reserve_pojo.accepted: - print("status is " + reserve_pojo.accepted) - if reserve_pojo.accepted is None or ResultEnum.PENDING.value == reserve_pojo.accepted: - executor.submit(Worker().run, threading.Event(), reserve_pojo, collection) + if reserve.accepted: + print("status is " + reserve.accepted) + if reserve.accepted is None or ResultEnum.PENDING.value == reserve.accepted: + executor.submit(Worker().run, reserve, collection) print(count) diff --git a/config.ini b/config.ini index 654e4db..4d8ff0b 100644 --- a/config.ini +++ b/config.ini @@ -1,4 +1,4 @@ [DEFAULT] -contact_list_file = .\contact_all.xlsx -firebase_config_file = .\appointment.json -LOGS_DIR = .\ \ No newline at end of file +contact_list_file = /Users/panlei/IdeaProjects/appointment_tool/contact_all.xlsx +firebase_config_file = /Users/panlei/IdeaProjects/appointment_tool/appointment.json +LOGS_DIR = ./ \ No newline at end of file