edgi-govdata-archiving / wayback

A Python API to the Internet Archive Wayback Machine
https://wayback.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
65 stars 12 forks source link

Raise custom errors instead of `HTTPError` #67

Closed Mr0grog closed 3 years ago

Mr0grog commented 3 years ago

In WaybackClient.get_memento(), we used to raise HTTPError instances from Requests. Instead, we now handle all errors from the Wayback Machine and raise custom exceptions. This also adds a NoMementoError for cases where the requested URL has never been archived by the Wayback Machine.

The main goal here is to largely abstract away the Requests API, including in errors, as part of a v0.3.0 release. This doesn’t completely do that, though: we can still raise some network-level errors from Requests (e.g. ConnectionError). @danielballan talked over that a little while back, and we think those are probably OK to leave as-is and not worry about for v0.3.0.

Fixes #64.