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

Give Memento objects a nicer repr #105

Open Mr0grog opened 2 years ago

Mr0grog commented 2 years ago

Calling repr() with a Memento object gets you a not-very-useful representation:

<wayback._models.Memento object at 0x102447970>

Instead, this should include some more info (at least the URL and timestamp?) and not include _models since users shouldn’t be importing that.

For example:

<wayback.Memento url="https://www3.epa.gov/" timestamp="20221001000000">
<wayback.Memento url="https://www3.epa.gov/" timestamp="2022-10-01T00:00:00Z">
<wayback.Memento "https://www3.epa.gov/" at 2022-10-01T00:00:00Z>

Or something along those lines.

This should just involve adding a __repr__(self) method to Memento.