Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail calls to openlibrary.php gracefully #9977

Merged
merged 2 commits into from
Nov 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions openlibrary/core/lending.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,9 @@ def _post(self, **payload):
).json()
logger.info("POST response: %s", jsontext)
return jsontext
except Exception: # TODO: Narrow exception scope
except (JSONDecodeError, Exception): # TODO: Narrow exception scope
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should split this into just JSONDecodeError and/or 403... And any other Exception and continue to raise

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might also consider using timeout=1 or something to reduce the wait time for calls we know should be fast.

logger.exception("POST failed")
raise
return {}


ia_lending_api = IA_Lending_API()
Loading