Skip to content

Commit

Permalink
Merge pull request jupyterhub#1908 from agoose77/agoose77/fix-depreca…
Browse files Browse the repository at this point in the history
…tion-utcnow

fix: handle deprecation of `datetime.utcnow()`
  • Loading branch information
minrk authored Jan 23, 2025
2 parents 65f807c + 1fdc709 commit 243fd34
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions binderhub/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Emit structured, discrete events when various actions happen.
"""

import datetime
import json
import logging
from datetime import datetime

import jsonschema
from jupyterhub.traitlets import Callable
Expand Down Expand Up @@ -98,8 +98,9 @@ def emit(self, schema_name, version, event):
schema = self.schemas[(schema_name, version)]
jsonschema.validate(event, schema)

now_utc = datetime.datetime.now(tz=datetime.timezone.utc)
capsule = {
"timestamp": datetime.utcnow().isoformat() + "Z",
"timestamp": now_utc.strftime("%Y-%m-%dT%H:%M:%S.%fZ"),
"schema": schema_name,
"version": version,
}
Expand Down

0 comments on commit 243fd34

Please sign in to comment.