add alternatives for deprecated utc datetime functions

This commit is contained in:
Mike Fährmann
2024-09-19 20:09:03 +02:00
parent a051e1c955
commit 2c7a0c3ca8
7 changed files with 68 additions and 19 deletions

View File

@@ -448,7 +448,8 @@ class PixivRankingExtractor(PixivExtractor):
self.log.warning("invalid date '%s'", date)
date = None
if not date:
date = (datetime.utcnow() - timedelta(days=1)).strftime("%Y-%m-%d")
now = util.datetime_utcnow()
date = (now - timedelta(days=1)).strftime("%Y-%m-%d")
self.date = date
return {"ranking": {
@@ -887,7 +888,7 @@ class PixivAppAPI():
"get_secure_url": "1",
}
time = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S+00:00")
time = util.datetime_utcnow().strftime("%Y-%m-%dT%H:%M:%S+00:00")
headers = {
"X-Client-Time": time,
"X-Client-Hash": hashlib.md5(