Skip to main content

一款web协程框架

Project description

CheeseAPI

一款协程友好的 web 框架

该框架为个人设计,仅供学习交流使用,各种 API 目前不会保证稳定性和向后兼容性

安装

pip install CheeseAPI

依赖

  1. CheeseLog

日志系统,CheeseAPI 使用它进行日志的输出与记录

  1. CheeseSignal

信号系统,CheeseAPI 使用它进行所有事件信号的管理与分发

项目结构

CheeseAPI采用模块结构:

| - User
    | - __init__.py
    | - model.py
    | - api.py
    | - scheduler.py
    | - service.py
    | - handle.py
    | - validator.py
| - Permission
    | - __init__.py
    | - model.py
    | - api.py
    | - service.py
    | - validator.py
| - __init__.py
| - app.py

CheeseAPI 并没有强制规定文件名,但建议的文件命名方式如下:

文件名 备注
__init__.py 公用变量
model.py ORM或类
api.py API接口
scheduler.py 定时任务
service.py 业务逻辑实现
handle.py 运行逻辑
validator.py 参数校验

使用

创建一个 app 文件 app.py

from CheeseAPI import CheeseAPI, Response

app = CheeseAPI()

@app.route.get('/')
async def index(**kwargs):
    return Response('这里是CheeseAPI!')

若在单文件中运行,继续添加入口即可

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

若在多文件项目中运行,可创建一个 manage.py 入口文件

from app import app

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

运行入口文件即可

示例

examples 目录下有一些示例项目,可以参考学习

文档

1. CheeseAPI(主模块)

2. Route(路由)

3. Request

4. Response

5. Websocket

6. File

7. Validator(数据校验)

8. Signal

9. Scheduler(任务调度)

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

cheeseapi-2.0.5b1.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cheeseapi-2.0.5b1-py2.py3-none-any.whl (30.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cheeseapi-2.0.5b1.tar.gz.

File metadata

  • Download URL: cheeseapi-2.0.5b1.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for cheeseapi-2.0.5b1.tar.gz
Algorithm Hash digest
SHA256 e5978aeae332ad0aed7e06f5a9754fb93bc56a42b269a93c55480a756af9fc58
MD5 7dc04a2f08c5a86cfa43b9e8a1fc4145
BLAKE2b-256 115cf82b1c16100059325eda6d1259ea7d7954e5a07859540c77330c55ad5248

See more details on using hashes here.

File details

Details for the file cheeseapi-2.0.5b1-py2.py3-none-any.whl.

File metadata

  • Download URL: cheeseapi-2.0.5b1-py2.py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for cheeseapi-2.0.5b1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8052839011e195b8e61da5e20c53e73a322c901e66999f1144901c0544224a34
MD5 a03d12b13a46dd9b31388693c7db374f
BLAKE2b-256 b73b259e0648b00ad7e0f2116f6014deff7151ffd292532e4236e4b251602b3b

See more details on using hashes here.

Supported by

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