Skip to content

对 FastApi 进行二次封装的简易 HTTP Web 服务 SDK

License

Notifications You must be signed in to change notification settings

AmiyaBot/Amiya-HTTP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AmiyaHttp

PyPI

FastAPI 进行二次封装的简易 HTTP Web 服务 SDK

文档地址:点击查看

import asyncio
from pydantic import BaseModel
from amiyahttp import HttpServer


# 定义 POST 请求参数
class UserModel(BaseModel):
    username: str
    nickname: str


server = HttpServer(host='0.0.0.0', port=8088)


@server.controller
class Bot:
    @server.route(method='get')
    async def get_name(self):
        return 'AmiyaBot'

    @server.route(method='post')
    async def say_hello(self, params: UserModel):
        return server.response(message=f'hello, {params.nickname}')


asyncio.run(server.serve())

About

对 FastApi 进行二次封装的简易 HTTP Web 服务 SDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages