Skip to content

Commit

Permalink
fix: datetime.utcnow() deprecation warning
Browse files Browse the repository at this point in the history
* (fix): precaution of `.utcnow()` is deprecated
  • Loading branch information
nautics889 committed Apr 6, 2024
1 parent 3273654 commit 5f6a6f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pixivpy3/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import os
import shutil
from datetime import datetime
from datetime import datetime, timezone
from typing import IO, Any

import cloudscraper # type: ignore[import]
Expand Down Expand Up @@ -118,7 +118,7 @@ def auth(
headers: ParamDict = None,
) -> ParsedJson:
"""Login with password, or use the refresh_token to acquire a new bearer token"""
local_time = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S+00:00")
local_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S+00:00")
headers_ = CaseInsensitiveDict(headers or {})
headers_["x-client-time"] = local_time
headers_["x-client-hash"] = hashlib.md5((local_time + self.hash_secret).encode("utf-8")).hexdigest()
Expand Down

0 comments on commit 5f6a6f2

Please sign in to comment.