DRY in _wayback_timestamp
This commit is contained in:
parent
10e918eebf
commit
77bc275333
@ -38,12 +38,8 @@ def _archive_url_parser(header):
|
|||||||
|
|
||||||
def _wayback_timestamp(**kwargs):
|
def _wayback_timestamp(**kwargs):
|
||||||
"""Return a formatted timestamp."""
|
"""Return a formatted timestamp."""
|
||||||
return (
|
return "".join(
|
||||||
str(kwargs["year"])
|
str(kwargs[key]).zfill(2) for key in ["year", "month", "day", "hour", "minute"]
|
||||||
+ str(kwargs["month"]).zfill(2)
|
|
||||||
+ str(kwargs["day"]).zfill(2)
|
|
||||||
+ str(kwargs["hour"]).zfill(2)
|
|
||||||
+ str(kwargs["minute"]).zfill(2)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -128,7 +124,7 @@ class Url:
|
|||||||
)
|
)
|
||||||
request_url = "https://archive.org/wayback/available?url=%s×tamp=%s" % (
|
request_url = "https://archive.org/wayback/available?url=%s×tamp=%s" % (
|
||||||
self._clean_url(),
|
self._clean_url(),
|
||||||
str(timestamp),
|
timestamp,
|
||||||
)
|
)
|
||||||
hdr = {"User-Agent": "%s" % self.user_agent}
|
hdr = {"User-Agent": "%s" % self.user_agent}
|
||||||
req = Request(request_url, headers=hdr) # nosec
|
req = Request(request_url, headers=hdr) # nosec
|
||||||
|
Loading…
Reference in New Issue
Block a user