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
61 stars 12 forks source link

v0.3.0: Requests API still visible via exceptions #64

Closed Mr0grog closed 3 years ago

Mr0grog commented 3 years ago

Part of the goal of v0.3.0 is to cover over the requests API so it’s easier to swap it out. While requests objects are no longer involved in method calls or return values, we still surface exceptions from requests in a few spots:

The last one is the one I'm most concerned about. It's not great that network errors come from an underlying framework that might change, but not the worst thing in the world. However, we should never explicitly raise that kind of error ourselves. Instead this should be a WaybackException or a MementoPlaybackError.

Additionally, there’s a special case we are not handling above: if the status is 404 on a non-memento, that means the URL has never been archived by the Wayback Machine, and we should raise a special exception for that case.