From fdf20ed223c09b7282d6af38f376be891a5975c7 Mon Sep 17 00:00:00 2001 From: CHUN YU YAO Date: Tue, 6 Jun 2023 23:14:38 +0800 Subject: [PATCH] add time delay for galaxymacau. --- chrome_tixcraft.py | 16 +++++++++++++--- config_launcher.py | 2 +- settings.py | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/chrome_tixcraft.py b/chrome_tixcraft.py index b65f0b7..63c79b0 100644 --- a/chrome_tixcraft.py +++ b/chrome_tixcraft.py @@ -54,7 +54,7 @@ import itertools import ssl ssl._create_default_https_context = ssl._create_unverified_context -CONST_APP_VERSION = u"MaxBot (2023.6.6)" +CONST_APP_VERSION = u"MaxBot (2023.6.7)" CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt" @@ -8525,10 +8525,20 @@ def hkticketing_main(driver, url, config_dict, hkticketing_dict): print("redirecting to url:", new_url) try: # web server is too busy to reponse. - driver.execute_script("retryIn=0;document.location.href = \"/default.aspx\";") + driver.execute_script("document.location.href = \"/default.aspx\";") except Exception as exc: pass - driver.get(new_url) + + try: + driver.get(new_url) + except Exception as exc: + pass + + # 刷太快, 會被封IP? + delay_second = config_dict["advanced"]["auto_reload_page_interval"] + if delay_second <= 4.0: + delay_second = 4.0 + time.sleep(delay_second) return hkticketing_dict diff --git a/config_launcher.py b/config_launcher.py index 63e3a1d..5faaf6a 100644 --- a/config_launcher.py +++ b/config_launcher.py @@ -22,7 +22,7 @@ import base64 import threading import subprocess -CONST_APP_VERSION = u"MaxBot (2023.6.6)" +CONST_APP_VERSION = u"MaxBot (2023.6.7)" CONST_MAXBOT_LAUNCHER_FILE = "config_launcher.json" CONST_MAXBOT_CONFIG_FILE = "settings.json" diff --git a/settings.py b/settings.py index b4060f2..48ade2b 100644 --- a/settings.py +++ b/settings.py @@ -25,7 +25,7 @@ import threading import subprocess import json -CONST_APP_VERSION = u"MaxBot (2023.6.6)" +CONST_APP_VERSION = u"MaxBot (2023.6.7)" CONST_MAXBOT_CONFIG_FILE = "settings.json" CONST_MAXBOT_LAST_URL_FILE = "MAXBOT_LAST_URL.txt"