Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
⚡️perf(cita): add delay to refresh
Browse files Browse the repository at this point in the history
The delay will try to fix the error 429 from the WAF

Signed-off-by: Jose Suarez <[email protected]>
  • Loading branch information
Josexv1 committed May 18, 2022
1 parent 88c9db7 commit 3622ce3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cita/cita.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": ""}],
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3622ce3

Please sign in to comment.