Skip to main content

a micro server

Project description

Simple-Starlette

License License License License License

python微服务框架:

  • 高性能 : asyncio + Uvicorn 高性能异步非阻塞io,事件循环,多路监听
  • 可读性 : 请求与视图解耦,视图与Service解耦,文档与业务解耦
  • 开发耗时: 多种基础工具和中间件,类似flask的开发体验

安装使用

1, 使用 pip 直接安装

pip install simple-starlette

2, 源码安装

git clone https://github.com/mapyJJJ/simple-starlette.git
cd simple-starlette
python3 setup.py install

hello world:

from simple_starlette.args import QueryParams
from simple_starlette import SimpleStarlette, Request
from simple_starlette.responses import Response, ResTypeEnum

app = SimpleStarlette(__name__)

@app.route("/test")
class Index:
    class SomeQuery(QueryParams):
        arg1: int
        arg2: int

    async def get(self, request: Request, q: SomeQuery):  # 定义一个get请求
        return Response({"arg1": q.arg1, "arg2": q.arg2}, ResTypeEnum.JSON) # 构造返回json字符串

if __name__ == "__main__":
    app.run()

# 测试请求
# curl http://localhost:9091/test?arg1=hello&arg2=world
# response:
# {"arg1":"hello", "arg2":"world"}

查看更多开发使用实例:example usage


LICENSE

GPL-3.0 License


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_starlette-3.0.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

simple_starlette-3.0.1-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file simple_starlette-3.0.1.tar.gz.

File metadata

  • Download URL: simple_starlette-3.0.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for simple_starlette-3.0.1.tar.gz
Algorithm Hash digest
SHA256 9bf313a65621bd55638070d825eb158de5f480f62099ab9060ec49cfe0d07832
MD5 26ee70df5c30ab9f85fea89d873abc17
BLAKE2b-256 6f35ad46aa609e318ccdd36e852550205c4d0069630944107fa9aac3d88506cd

See more details on using hashes here.

File details

Details for the file simple_starlette-3.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_starlette-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa09c469b2ed3ddc75af74e4141832457255b1b686635c745387c13b734ee137
MD5 84884b247a179c0203887e99a22e9782
BLAKE2b-256 bb195cfb4a7b692fef24715151649427477078e25b6a9a361beeb9fca00ab03f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page