This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NANO_TIMESTAMP=$(date +%s%N) | |
curl -XPOST "http://localhost:8086/write?db=metrics" --data-binary "mymeas,mytag=1 myfield=90 $NANO_TIMESTAMP"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom datetime class that can be initialized by date string and has default format | |
# useful for automatic serialization/deserializaion (to JSON, or other formats) such that | |
# when deserialized constructore can be called directly CustomDate(<string>) and serialization is just str() | |
import datetime | |
class CustomDate(datetime.datetime): | |
__date_format = '%Y/%m/%d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Parsing complex json structure with pydantic. | |
Using example json file from from nobelprize.org | |
### laureate.json from http://api.nobelprize.org/v1/laureate.json | |
Original data looked like this: | |
------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flask | |
from marshmallow import Schema, fields as schema_field_type | |
from flask_apispec import use_kwargs, marshal_with, FlaskApiSpec, MethodResource | |
from flask_apispec.annotations import doc | |
from flask_restful import Resource as RestfulResource, Api | |
from flask_marshmallow import Marshmallow | |
from flask_sqlalchemy import SQLAlchemy |