Skip to content

feat: Improve error handling#372

Open
AntonBronnfjell wants to merge 2 commits intolorenzodifuccia:masterfrom
AntonBronnfjell:feature/improve-error
Open

feat: Improve error handling#372
AntonBronnfjell wants to merge 2 commits intolorenzodifuccia:masterfrom
AntonBronnfjell:feature/improve-error

Conversation

@AntonBronnfjell
Copy link

This pull request improves error handling and adds a new command-line option for SSL skipping in safaribooks.py. The main changes ensure that API errors are more clearly reported with HTTP status codes and parsing errors, and introduce a mechanism to optionally skip SSL verification via a command-line flag.

Error handling improvements:

  • Added checks for non-200 HTTP status codes in the get_book_info, get_book_chapters, and create_toc methods, with clear error messages indicating the HTTP status and possible causes. [1] [2] [3]
  • Added error handling for invalid JSON responses in the same methods, exiting with an informative message if the API response cannot be parsed. [1] [2] [3]

Command-line enhancements:

  • Introduced a new ssl-skip command-line argument that allows users to skip SSL verification. The flag is detected and removed from sys.argv, and its value is stored in the parsed arguments for later use. [1] [2]

Escalante Antonio added 2 commits March 3, 2026 11:23
- Added checks for HTTP status codes and improved error messages for book info, chapters, and TOC retrieval.
- Implemented JSON parsing error handling to ensure valid responses.
- Introduced ssl-skip parameter handling in the main execution block.
- Updated the session configuration to set SSL verification to False when using a proxy.
- Removed unnecessary whitespace for cleaner code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant