aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/github_utils.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2023-05-13 14:31:39 +0100
committerGravatar Chris Lovering <[email protected]>2023-05-13 14:34:33 +0100
commit509449c1a7d4230c3a4b1e335b681fbecf0313c0 (patch)
tree27ea2c360723503528ec9b2069dd513b9b26f613 /pydis_site/apps/api/github_utils.py
parentSpecify file encoding so tests pass on windows (diff)
Use the new datetime.UTC alias over datetime.timezone.utc
Diffstat (limited to 'pydis_site/apps/api/github_utils.py')
-rw-r--r--pydis_site/apps/api/github_utils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pydis_site/apps/api/github_utils.py b/pydis_site/apps/api/github_utils.py
index af659195..b1a7d07d 100644
--- a/pydis_site/apps/api/github_utils.py
+++ b/pydis_site/apps/api/github_utils.py
@@ -82,7 +82,7 @@ def generate_token() -> str:
Refer to:
https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app
"""
- now = datetime.datetime.now(tz=datetime.timezone.utc)
+ now = datetime.datetime.now(tz=datetime.UTC)
return jwt.encode(
{
"iat": math.floor((now - datetime.timedelta(seconds=60)).timestamp()), # Issued at
@@ -148,9 +148,9 @@ def check_run_status(run: WorkflowRun) -> str:
created_at = (
datetime.datetime
.strptime(run.created_at, settings.GITHUB_TIMESTAMP_FORMAT)
- .replace(tzinfo=datetime.timezone.utc)
+ .replace(tzinfo=datetime.UTC)
)
- run_time = datetime.datetime.now(tz=datetime.timezone.utc) - created_at
+ run_time = datetime.datetime.now(tz=datetime.UTC) - created_at
if run.status != "completed":
if run_time <= MAX_RUN_TIME: