* fix: CI yml name * add: mypy configuraion * add: type annotation to waybackpy modules * add: type annotation to test modules * fix: mypy command * add: types-requests to dev deps * fix: disable max-line-length * fix: move pytest.ini into setup.cfg * add: urllib3 to deps * fix: Retry (ref: https://github.com/python/typeshed/issues/6893) * fix: f-string * fix: shorten long lines * add: staticmethod decorator to no-self-use methods * fix: str(headers)->headers_str * fix: error message * fix: revert "str(headers)->headers_str" and ignore assignment CaseInsensitiveDict with str * fix: mypy error
67 lines
1.1 KiB
Python
67 lines
1.1 KiB
Python
"""
|
|
waybackpy.exceptions
|
|
~~~~~~~~~~~~~~~~~~~
|
|
This module contains the set of Waybackpy's exceptions.
|
|
"""
|
|
|
|
|
|
class WaybackError(Exception):
|
|
"""
|
|
Raised when Waybackpy can not return what you asked for.
|
|
1) Wayback Machine API Service is unreachable/down.
|
|
2) You passed illegal arguments.
|
|
|
|
All other exceptions are inherited from this class.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class RedirectSaveError(WaybackError):
|
|
"""
|
|
Raised when the original URL is redirected and the
|
|
redirect URL is archived but not the original URL.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class URLError(Exception):
|
|
"""
|
|
Raised when malformed URLs are passed as arguments.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class MaximumRetriesExceeded(WaybackError):
|
|
"""
|
|
MaximumRetriesExceeded
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class MaximumSaveRetriesExceeded(MaximumRetriesExceeded):
|
|
"""
|
|
MaximumSaveRetriesExceeded
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class ArchiveNotInAvailabilityAPIResponse(WaybackError):
|
|
"""
|
|
Could not parse the archive in the JSON response of the availability API.
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class InvalidJSONInAvailabilityAPIResponse(WaybackError):
|
|
"""
|
|
availability api returned invalid JSON
|
|
"""
|
|
|
|
pass
|