Use datetime.datetime in _wayback_timestamp
This commit is contained in:
		| @@ -36,11 +36,9 @@ def _archive_url_parser(header): | |||||||
|     ) |     ) | ||||||
|  |  | ||||||
|  |  | ||||||
| def _wayback_timestamp(**kwargs): | def _wayback_timestamp(dt): | ||||||
|     """Return a formatted timestamp.""" |     """Return a formatted timestamp.""" | ||||||
|     return "".join( |     return dt.strftime("%Y%m%d%h%m") | ||||||
|         str(kwargs[key]).zfill(2) for key in ["year", "month", "day", "hour", "minute"] |  | ||||||
|     ) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| class Url: | class Url: | ||||||
| @@ -113,14 +111,14 @@ class Url: | |||||||
|         Supported params are year, month, day, hour and minute. |         Supported params are year, month, day, hour and minute. | ||||||
|         Any non-supplied parameters default to the current time. |         Any non-supplied parameters default to the current time. | ||||||
|         """ |         """ | ||||||
|         now = datetime.utcnow().timetuple() |         kwargs = { | ||||||
|         timestamp = _wayback_timestamp( |             key: val | ||||||
|             year=year if year else now.tm_year, |             for key, val in dict( | ||||||
|             month=month if month else now.tm_mon, |                 year=year, month=month, day=day, hour=hour, minute=minute | ||||||
|             day=day if day else now.tm_mday, |             ) | ||||||
|             hour=hour if hour else now.tm_hour, |             if val is not None | ||||||
|             minute=minute if minute else now.tm_min, |         } | ||||||
|         ) |         timestamp = _wayback_timestamp(datetime.utcnow().replace(**kwargs)) | ||||||
|  |  | ||||||
|         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(), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user