Flask with UltraJSON.
Project description
flask-ujson
pip install flask-ujson
Flask with UltraJSON.
https://github.com/ultrajson/ultrajson
from flask import Flask, request
from flask_ujson import UJSON
ultra_json = UJSON()
def create_app():
app = Flask(__name__)
ultra_json.init_app(app)
@app.route("/")
def index():
"""
Outputs a JSON response using UltraJSON library
https://github.com/ultrajson/ultrajson
"""
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_ujson-1.0.5.tar.gz
(12.0 kB
view details)
Built Distribution
File details
Details for the file flask_ujson-1.0.5.tar.gz
.
File metadata
- Download URL: flask_ujson-1.0.5.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 | e079cfaa7333727d4de1943afb362ec43f91aebe0882888ecfcb3f4fad9867b1 |
|
MD5 | c998d3b23b0ac68b36194b38b73680e1 |
|
BLAKE2b-256 | fc65a307aa882b98e41bd680fa6536a0bcb34ca3c1f6957c3e47c3318a87ad5b |
Provenance
File details
Details for the file flask_ujson-1.0.5-py3-none-any.whl
.
File metadata
- Download URL: flask_ujson-1.0.5-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 | 9fc1a11d99e22aa9a0c4cbeb38ebc6aca047c8885bf3e99befc7e8d59b2b7892 |
|
MD5 | dc19a2009417402baa973dc0712a43dc |
|
BLAKE2b-256 | 45252b57464cdbb7c2cdbc26d62ecdfcd432127d279166136b3e005ff6d13208 |