Flask with UltraJSON.
Project description
flask-orjson
pip install flask-orjson
Flask with orjson.
from flask import Flask, request
from flask_orjson import ORJSON
orjson = ORJSON()
def create_app():
app = Flask(__name__)
orjson.init_app(app)
@app.route("/")
def index():
"""
Outputs a JSON response using the orjson library
https://github.com/ijl/orjson
"""
return {
"timestamp": 1556283673.1523004,
"task_uuid": "0ed1a1c3-050c-4fb9-9426-a7e72d0acfc7",
"task_level": [1, 2, 1],
"action_status": "started",
"action_type": "main",
"key": "value",
"another_key": 123,
"and_another": ["a", "b"],
}
@app.post("/post")
def accept_json():
json = request.get_json()
return json
return app
if __name__ == "__main__":
app = create_app()
app.run(debug=True)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flask_orjson-1.0.0.tar.gz
(12.0 kB
view details)
Built Distribution
File details
Details for the file flask_orjson-1.0.0.tar.gz
.
File metadata
- Download URL: flask_orjson-1.0.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b5951365a2477b4959ec769a53633e747e075f1e8e3dfdace49d33b100c8cb5 |
|
MD5 | 74bbcc5d3f7a9237a3185900e4588c74 |
|
BLAKE2b-256 | d121c7bcf8a25d378cbdab40411209af73b6292d618875fb79bfd47986891a0f |
File details
Details for the file flask_orjson-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: flask_orjson-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bb7383bf85924e09f8090fbe442cee662d86ec670fa0bfc3ccce6b4dcd904da |
|
MD5 | 3717dd8ce78531de1d8955900eb09cda |
|
BLAKE2b-256 | 096be2ccd58f5d9e3a45b10d059f92331f386dbffdcc46739f32f6c5d2d2d64b |