Mercurial > personal > weather-server
diff weather_server/common.py @ 39:b77c8e7d2742
Use zoneinfo rather than pytz.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Tue, 01 Apr 2025 15:54:21 -0400 |
parents | 52ef21607b31 |
children |
line wrap: on
line diff
--- a/weather_server/common.py Tue Apr 01 15:46:16 2025 -0400 +++ b/weather_server/common.py Tue Apr 01 15:54:21 2025 -0400 @@ -3,10 +3,9 @@ import typing as t import bson -import pytz BSON_OPTIONS = bson.DEFAULT_CODEC_OPTIONS.with_options( - tz_aware=True, tzinfo=pytz.UTC) + tz_aware=True, tzinfo=datetime.UTC) def bson_encode(data: t.Dict[str, t.Any]) -> bytes: @@ -29,4 +28,4 @@ def utc_now(): - return datetime.datetime.utcnow().replace(tzinfo=pytz.UTC) + return datetime.datetime.now(datetime.UTC)