From 3622ce32199f64d24c0d9c932a7cc338f7c4ec5e Mon Sep 17 00:00:00 2001 From: Jose Suarez Date: Wed, 18 May 2022 14:05:04 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8Fperf(cita):=20=20add=20delay?= =?UTF-8?q?=20to=20refresh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The delay will try to fix the error 429 from the WAF Signed-off-by: Jose Suarez --- cita/cita.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cita/cita.py b/cita/cita.py index c564563..33da724 100644 --- a/cita/cita.py +++ b/cita/cita.py @@ -204,14 +204,13 @@ def init_wedriver(context: CustomerProfile): options.add_argument(f"profile-directory={context.chrome_profile_name}") ua = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36" - options.add_experimental_option("excludeSwitches", ["enable-automation", "enable-logging"]) options.add_experimental_option("useAutomationExtension", False) options.add_argument('--ignore-certificate-errors') options.add_argument('--ignore-ssl-errors') options.add_argument("--disable-gpu") options.add_argument("--window-size=600,800") - options.add_argument("--window-position=0,0"); + options.add_argument("--window-position=0,0") settings = { "recentDestinations": [{"id": "Save as PDF", "origin": "local", "account": ""}], @@ -662,8 +661,8 @@ def office_selection(driver: webdriver, context: CustomerProfile): btn.send_keys(Keys.ENTER) return True elif "En este momento no hay citas disponibles" in resp_text: - logger.info("[Step 1/6][!!] No appointments available, refreshing page") - time.sleep(5) + logger.info("[Step 1/6] No appointments available refreshing 30 seconds %s/%s", i, REFRESH_PAGE_CYCLES) + time.sleep(30) driver.refresh() continue else: