30 Star 245 Fork 57

keijack / naja-atra

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Naja-Atra

Naja-Atra 是一个轻量化的 Python Web 框架。支持 HTTP 与 WebSocket 协议。

安装

请使用 pip 进行安装:

$ pip install -U naja-atra

一个简单的例子:

from naja_atra import route

@route('/')
def hello(name: str = 'World'):
    return {'message': f'Hello, {name}!'}

要执行,请使用 naja_atra 命令来运行:

$ python3 -m naja_atra

或者,也可以使用代码来运行:

from naja_atra import route
from naja_atra import server


@route("/")
def hello(name: str = 'World'):
    return {"message": f"Hello {name}"}

def main():
    server.start(host="0.0.0.0", port=9090)

if __name__ == "__main__":
    main()

More

MIT License Copyright (c) 2018 Keijack Wu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个超轻量级的 HTTP Server,支持线程和协程模式,源生支持 websocket 哦!你也可以非常容易的将其嵌入到 WSGI 与 ASGI 的服务器里。并且支持分布式 Session! 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/keijack/naja-atra.git
git@gitee.com:keijack/naja-atra.git
keijack
naja-atra
naja-atra
main

搜索帮助