Skip to content

Commit

Permalink
Fix Python 3.12 deprecation warning in datetime
Browse files Browse the repository at this point in the history
`datetime.datetime.utcnow()` is deprecated:
https://docs.python.org/3/whatsnew/3.12.html#deprecated
  • Loading branch information
amureki authored and codingjoe committed Dec 11, 2023
1 parent a3c4952 commit f8aed30
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion s3file/storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class client:
def generate_presigned_post(bucket_name, key, **policy):
policy = json.dumps(policy).encode()
policy_b64 = base64.b64encode(policy).decode()
date = datetime.datetime.utcnow().strftime("%Y%m%dT%H%M%SZ")
date = datetime.datetime.now(tz=datetime.timezone.utc).strftime(
"%Y%m%dT%H%M%SZ"
)
aws_id = getattr(
settings,
"AWS_ACCESS_KEY_ID",
Expand Down

0 comments on commit f8aed30

Please sign in to comment.