Skip to content

Commit

Permalink
Handle RetryError
Browse files Browse the repository at this point in the history
  • Loading branch information
duckduckgrayduck committed Jan 24, 2024
1 parent 0cc936d commit 795face
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from bs4 import BeautifulSoup, Tag
from tenacity import (
retry,
RetryError,
stop_after_attempt,
wait_random_exponential,
) # for exponential backoff
Expand Down Expand Up @@ -208,18 +209,15 @@ def monitor_with_selector(self, site, selector):
if new_timestamp == old_timestamp:
print("New timestamp is the same as the old timestamp.")
sys.exit(0)
except savepagenow.exceptions.WaybackRuntimeError:
print("WaybackRunTimeError")
self.send_notification(
f"Klaxon Alert: {site} Updated",
f"Get results here (you must be logged in!): {file_url} \n"
f"New snapshot: {new_archive_url} \n"
f"Visual content wayback comparison: {changes_url}",
)
except RetryError:
print("Issue with retrieving new URL from the Wayback Machine")
sys.exit(0)
except savepagenow.exceptions.CachedPage:
print("CachedPageError")
sys.exit(0)
self.send_notification(
f"Klaxon Alert: {site} Updated",
f"Get results here (you must be logged in!): {file_url} \n"
f"New snapshot: {new_archive_url} \n"
f"Visual content wayback comparison: {changes_url}",
)

def main(self):
# pylint:disable=attribute-defined-outside-init
Expand Down

0 comments on commit 795face

Please sign in to comment.