Mercurial > personal > weather-server
view weather_server/common.py @ 9:f1ea183d28ba
Give a 404 rather than a 500 on missing locations.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 29 Sep 2019 20:34:38 -0400 |
parents | efe7a1eff167 |
children | 52ef21607b31 |
line wrap: on
line source
import typing as t import bson import pytz BSON_OPTIONS = bson.DEFAULT_CODEC_OPTIONS.with_options( tz_aware=True, tzinfo=pytz.UTC) def bson_encode(data: t.Dict[str, t.Any]) -> bytes: return bson.BSON.encode(data, codec_options=BSON_OPTIONS)