Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: datetime.utcnow() deprecation warning #348

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading