MissingKids selenium app fix
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
|
||||
FROM python:3.12
|
||||
|
||||
# Architecture
|
||||
# Architecture: amd64
|
||||
#ARG ARCH_G=linux64
|
||||
#ARG ARCH_F=linux-x86_64
|
||||
# Architecture: arm64
|
||||
ARG ARCH_G=linux-aarch64
|
||||
ARG ARCH_F=linux-aarch64
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import os
|
||||
from logger import get_logger
|
||||
logger = get_logger()
|
||||
|
||||
|
||||
def get_webdriver():
|
||||
options = Options()
|
||||
options.add_argument('--headless') # Optional
|
||||
@@ -62,7 +61,7 @@ class MissingKidsFetcher():
|
||||
num_exceptions += 1
|
||||
processed_ok = False
|
||||
|
||||
if (num_exceptions == 3):
|
||||
if (num_exceptions == 2):
|
||||
continue_iterating = False
|
||||
else:
|
||||
logger.info("Exception while clicking page {}, retrying...".format(i+1))
|
||||
@@ -77,22 +76,15 @@ class MissingKidsFetcher():
|
||||
logger.info(e.text)
|
||||
|
||||
# driver.refresh()
|
||||
time.sleep(os.getenv("SELENIUM_SLEEP_PER_PAGE", 4));
|
||||
time.sleep(os.getenv("SELENIUM_SLEEP_PER_PAGE", 4))
|
||||
|
||||
if (i == first_n_pages):
|
||||
continue_iterating = False
|
||||
if (processed_ok):
|
||||
i += 1
|
||||
num_exceptions = 0
|
||||
|
||||
except Exception as e:
|
||||
logger.warning("Exception while clicking page {}. {}".format(i+1, str(e)), exc_info=True)
|
||||
finally:
|
||||
try:
|
||||
logger.info("Closing web driver and returning results")
|
||||
driver.close()
|
||||
except Exception as e:
|
||||
logger.warning("Exception closing web driver: {}".format(str(e)))
|
||||
pass
|
||||
logger.warning("Exception while fetching MissingKids {}".format(str(e)), exc_info=True)
|
||||
set_urls = set()
|
||||
|
||||
return set_urls
|
||||
|
||||
Reference in New Issue
Block a user