Skip to content

Commit

Permalink
Merge pull request #28 from NYPL/overdrive-fix
Browse files Browse the repository at this point in the history
Handle any OverDrive exception
  • Loading branch information
aaronfriedman6 authored Nov 12, 2024
2 parents b856049 + 2a3d091 commit 0a4cbbb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2024-11-12
### Fixed
- Gracefully handle any exception thrown by the OverDrive web scraper

## 2024-09-19
### Added
- Refactor code to run in an ECS cluster rather than as a Lambda
Expand Down
6 changes: 3 additions & 3 deletions alarms/models/overdrive_checkouts_alarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
check_redshift_mismatch_alarm,
check_no_records_found_alarm,
)
from helpers.overdrive_web_scraper import OverDriveWebScraper, OverDriveWebScraperError
from helpers.overdrive_web_scraper import OverDriveWebScraper
from helpers.query_helper import build_redshift_overdrive_query
from nypl_py_utils.functions.log_helper import create_log

Expand All @@ -20,8 +20,8 @@ def run_checks(self):
self.logger.info("\nOVERDRIVE CHECKOUTS\n")
try:
overdrive_count = self.overdrive_client.get_count(self.yesterday)
except OverDriveWebScraperError:
self.logger.error("Failed to scrape OverDrive Marketplace")
except Exception as e:
self.logger.error(f"Failed to scrape OverDrive Marketplace: {e}")
return

redshift_table = "overdrive_checkouts" + self.redshift_suffix
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nypl-py-utils[mysql-client,postgresql-client,redshift-client,config-helper]==1.3.2
nypl-py-utils[mysql-client,postgresql-client,redshift-client,config-helper]==1.4.0
selenium>=4.10.0

0 comments on commit 0a4cbbb

Please sign in to comment.