发现个利器--FastAPI(Py3.6+版本)

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
    return {"item_id": item_id, "q": q}

这么方便就算了,然后打开http://127.0.0.1:8000/docs,能看到接口信息!超便捷!

GitHub地址:https://github.com/tiangolo/fastapi

posted @ 2020-06-28 08:24  bamboo233  阅读(323)  评论(0编辑  收藏  举报