Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions cs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from datetime import datetime, timedelta
from fnmatch import fnmatch
from urllib.parse import quote

import pytz
from zoneinfo import ZoneInfo

import requests
from requests.structures import CaseInsensitiveDict
Expand Down Expand Up @@ -245,8 +244,9 @@ def _prepare_request(
params.setdefault("pagesize", PAGE_SIZE)
if "expires" not in params and self.expiration.total_seconds() >= 0:
params["signatureVersion"] = "3"
tz = pytz.utc
expires = tz.localize(datetime.utcnow() + self.expiration)
tz = ZoneInfo("UTC")
expires = datetime.utcnow() + self.expiration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which is deprecated in recent versions as well. datetime.UTC is only there since 3.11, so maybe this is the best way out.

https://blog.miguelgrinberg.com/post/it-s-time-for-a-change-datetime-utcnow-is-now-deprecated

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quite happy for this to be closed and replaced which ever option you think is the best

expires = expires.replace(tzinfo=tz)
params["expires"] = expires.astimezone(tz).strftime(EXPIRES_FORMAT)

kind = "params" if self.method == "get" else "data"
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ packages = find:
include_package_data = true
zip_safe = false
install_requires =
pytz
requests

[options.packages.find]
Expand Down