Mercurial > personal > weather-server
comparison weather_server/common.py @ 0:efe7a1eff167
Create initial logger for weather server.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Sat, 28 Sep 2019 23:17:21 -0400 |
| parents | |
| children | 52ef21607b31 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:efe7a1eff167 |
|---|---|
| 1 import typing as t | |
| 2 | |
| 3 import bson | |
| 4 import pytz | |
| 5 | |
| 6 BSON_OPTIONS = bson.DEFAULT_CODEC_OPTIONS.with_options( | |
| 7 tz_aware=True, tzinfo=pytz.UTC) | |
| 8 | |
| 9 | |
| 10 def bson_encode(data: t.Dict[str, t.Any]) -> bytes: | |
| 11 return bson.BSON.encode(data, codec_options=BSON_OPTIONS) |
