back math notaion in CLI
Project description
JSON API
Make you focus on writting business logic code, just return dict data for API, or other Response directly.
What you need to do is inherit the Magic class and overwrite several methods, then use method it provides to add route to your framework app.
pip3 install json-api
Usage Examples
Sanic Framework
import os
from sanic import Sanic
from json_api.magic_sanic import MagicSanic
magic = MagicSanic()
app = Sanic()
magic.set_app(app)
async def index(request, name="world"):
return {"hello": name}
async def register(request, name, email, password):
password = password or generate_random_password()
user = new_user(name, email, password)
return user.to_dict()
async def get_user_information(request, name):
user = get_user_by_name(name)
if not user:
return {'reason': 'not found'}, 404
return user.to_dict()
magic.add_route("/", index)
magic.add_route("/api/user/register", register, methods=["POST"])
magic.add_route("/api/user/info", get_user_information)
if __name__ == "__main__":
debug = True if os.getenv("DEBUG") else False
app.run(host="0.0.0.0", port=8000, debug=debug)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for math_fold-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cc63beab5c5b7a40fcbfbbf1f04b68be4e039542413d6160511be4bfca95957 |
|
MD5 | 9138f34426410b4de971d06bd2c6f94e |
|
BLAKE2b-256 | c6ab9f197bcde4b34d0a32dc4d4cba14c571d1bbbda2656f244f991a65f7cb7d |