akamhy / waybackpy

Wayback Machine API interface & a command-line tool
https://pypi.org/project/waybackpy/
MIT License
462 stars 34 forks source link

Fixing len() bug #32

Closed dv11364 closed 3 years ago

dv11364 commented 3 years ago

Fixed a bug where if there was no archive len() could not return a value since it was subtracting none from a datetime. I fixed it by making links with a lack of archive have self.timestamp = datetime.max and had len() return the max number of days possible in a timedelta object. Meaning if you wanted to implement .save() by checking whether the age of the latest archive was greater than some limit using len(), and that archive does not exist for that link, then you'd be able to implement .save regardless of the limit.