RobynRust 編寫的異步 Python Web 服務(wù)器
Robyn 是 Rust 編寫的異步 Python 后端 Web 服務(wù)器,在 Rust 異步運(yùn)行時(shí)之上運(yùn)行 Python 服務(wù)。
安裝
pip install robyn
使用
from robyn import Robyn
app = Robyn(__file__)
@app.get("/")
async def h():
return "Hello, world!"
app.start(port=5000)
GET 請(qǐng)求
@app.get("/")
async def h(request):
return "Hello World"
POST 請(qǐng)求
@app.post("/post")
async def postreq(request):
return bytearray(request["body"]).decode("utf-8")
評(píng)論
圖片
表情
