Merge branch 'master' of bitbucket.org:panleicim/appointment_tool

This commit is contained in:
2022-11-01 22:35:16 +01:00
+7 -2
View File
@@ -25,6 +25,7 @@ NOT_AVAILABLE_CONTENT = "For more than 130 years, our House has offered its full
PENDING_SENTENCE = "Ce soir, entre 20:00 et 20:30, vous obtiendrez une réponse par e-mail."
URL_TO_VALID_SENTENCE = "Nous avons envoyé un lien par e-mail."
PENDING_SENTENCE_EN = "This evening between 20:00 and 20:30 you will receive a response by email."
CAPTCHA_URL = "https://geo.captcha-delivery.com"
# URLs to ignore during checking results
BLANK_URL = "about:blank"
WELCOME_URL = "https://rendezvousparis.hermes.com/client/welcome"
@@ -66,12 +67,12 @@ class ResultChecker:
url = reserve_pojo.url
print("url is " + url)
content = None
proxy = params.get_proxy(ProxyType.RESIDENTIAL)
proxy = params.get_proxy(ProxyType.OXYLABS)
device = random.choice(params.DEVICES)
self.logger.info("模拟设备: " + device)
while content is None:
content = self.load_page(self.tls.playwright, proxy, url, device, headless)
proxy = params.get_proxy(ProxyType.RESIDENTIAL)
proxy = params.get_proxy(ProxyType.OXYLABS)
print(content)
print("Stopped worker in ", threading.current_thread().name)
if SORRY_SENTENCE_FR in content:
@@ -92,6 +93,9 @@ class ResultChecker:
elif NOT_AVAILABLE_CONTENT in content:
print("status is REFUSED")
status = ResultEnum.REFUSED
elif CAPTCHA_URL in content:
print("status is BLOCKED")
self.browser.close()
else:
print("status is ACCEPTED")
status = ResultEnum.ACCEPTED
@@ -126,6 +130,7 @@ def start_check(reserve_list, firestore_collection, headless: bool, need_send_em
count = count + 1
if reserve.accepted is None or ResultEnum.ACCEPTED.value == reserve.accepted:
print("will check result")
if "hotmail" in reserve.email:
if reserve.url != BLANK_URL:
if reserve.url != WELCOME_URL:
executor.submit(ResultChecker().run, reserve, firestore_collection, headless,