sync problem with playwright

This commit is contained in:
panlei
2022-05-15 22:52:42 +02:00
parent b093a3f2db
commit 9e4972c8c9
5 changed files with 75 additions and 14 deletions
+1
View File
@@ -12,3 +12,4 @@ out
lib lib
appointment_*.log appointment_*.log
./build ./build
./dist
+3 -3
View File
@@ -49,7 +49,7 @@ coll = COLLECT(
name='appointment', name='appointment',
) )
import shutil import shutil
shutil.copyfile('C:\\Users\\landd\\IdeaProjects\\appointment_tool\\appointment.json', '{0}/appointment.json'.format(DISTPATH)) shutil.copyfile('./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('./contact_all.xlsx', '{0}/contact_all.xlsx'.format(DISTPATH))
shutil.copyfile('.\config.ini', '{0}/config.ini'.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)) shutil.copytree('./venv\Lib/site-packages/grpc/_cython/_credentials', '{0}/appointment/grpc/_cython/_credentials'.format(DISTPATH))
+55
View File
@@ -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))
+13 -8
View File
@@ -10,7 +10,7 @@ from playwright.sync_api import sync_playwright
import params import params
from workers.commandor_page import get_random_id_number_for_proxy from workers.commandor_page import get_random_id_number_for_proxy
from logs.LogSender import TYPE_EVENT_CHECK_RESULTS, LOG_SUBJECT_EVENT 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" 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." 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 db_manager = params.firebase_store_manager
collection = db_manager.get_all_successful_items() collection = db_manager.get_all_successful_items()
count = 0 count = 0
task_list = list() result_pojo = ReserveResultPojo(type=PublishType.SUCCESS, phone="0649614591", email="panleicim@gmail.com",
with ThreadPoolExecutor(max_workers=2) as executor: message="SUCCESS", firstName="Lei", lastName="PAN")
result_list = []
for appointment in collection.stream(): for appointment in collection.stream():
count = count + 1
reserve_pojo = ReserveResultPojo.from_firestore_dict(appointment.to_dict()) reserve_pojo = ReserveResultPojo.from_firestore_dict(appointment.to_dict())
if reserve_pojo.accepted: result_list.append(result_pojo)
print("status is " + reserve_pojo.accepted)
if reserve_pojo.accepted is None or ResultEnum.PENDING.value == reserve_pojo.accepted: with ThreadPoolExecutor(max_workers=2) as executor:
executor.submit(Worker().run, threading.Event(), reserve_pojo, collection) for reserve in result_list:
count = count + 1
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) print(count)
+3 -3
View File
@@ -1,4 +1,4 @@
[DEFAULT] [DEFAULT]
contact_list_file = .\contact_all.xlsx contact_list_file = /Users/panlei/IdeaProjects/appointment_tool/contact_all.xlsx
firebase_config_file = .\appointment.json firebase_config_file = /Users/panlei/IdeaProjects/appointment_tool/appointment.json
LOGS_DIR = .\ LOGS_DIR = ./