squashing bug
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
from waybackpy.exceptions import WaybackError
|
from waybackpy.exceptions import WaybackError
|
||||||
from waybackpy.__version__ import __version__
|
from waybackpy.__version__ import __version__
|
||||||
|
|
||||||
@@ -80,9 +80,14 @@ class Url:
|
|||||||
return "%s" % self.archive_url
|
return "%s" % self.archive_url
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
if type(self.timestamp) is None:
|
td_max = timedelta(days=999999999,
|
||||||
return None
|
hours=23,
|
||||||
else
|
minutes=59,
|
||||||
|
seconds=59,
|
||||||
|
microseconds=999999)
|
||||||
|
if self.timestamp == datetime.max:
|
||||||
|
return td_max.days
|
||||||
|
else:
|
||||||
diff = datetime.utcnow() - self.timestamp
|
diff = datetime.utcnow() - self.timestamp
|
||||||
return diff.days
|
return diff.days
|
||||||
|
|
||||||
@@ -126,7 +131,7 @@ class Url:
|
|||||||
data = self.JSON
|
data = self.JSON
|
||||||
|
|
||||||
if not data["archived_snapshots"]:
|
if not data["archived_snapshots"]:
|
||||||
time = None
|
time = datetime.max
|
||||||
else:
|
else:
|
||||||
time = datetime.strptime(data["archived_snapshots"]
|
time = datetime.strptime(data["archived_snapshots"]
|
||||||
["closest"]
|
["closest"]
|
||||||
|
Reference in New Issue
Block a user