A lightweight, class-based, easy-to-use ASGI framework
Project description
gazi
A lightweight, class-based, easy-to-use ASGI framework
Docs
- main.py
from gazi import App
from home import _ as Home
from api import API
app = App()
app.handlers([Home, API])
- home.py
from gazi.route import method
from gazi.response import HtmlResponse, Response
# Path: /*
class _:
def __init__(self) -> None:
pass
# Path: /
@method.GET
def __render__(self) -> Response:
return HtmlResponse("<h1>Hello, world!</h1>")
- api.py
from gazi.response import HtmlResponse, Response
from gazi.request import Request
from gazi.route import method
# Path: /api/*
class API:
def __init__(self) -> None:
pass
# Path: /api
@method.GET
def __render__(self) -> Response:
return Response("API")
# Path: /api/hello
@method.GET
def hello(self, request: Request) -> Response:
return HtmlResponse(
f"<h1>Hello world, Username: {request.query('name')}</h1>", # data
{"test1": "test", "asd": "a"}, # headers
)
# Path: /api/bye?name=test
@method.POST
def bye(self, request: Request) -> Response:
return HtmlResponse(f"<h1>Bye world, Username: {request.query('name')}</h1>")
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
gazi-0.1.5.tar.gz
(5.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
gazi-0.1.5-py3-none-any.whl
(6.0 kB
view details)
File details
Details for the file gazi-0.1.5.tar.gz.
File metadata
- Download URL: gazi-0.1.5.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93377de3ca582b23b828c2d3caba90221b3291f2581ef4cd939751bc5f81b411
|
|
| MD5 |
dd3c9b19bd590eb50e7e71ff400bf1d6
|
|
| BLAKE2b-256 |
c9b5283135576b248697dd6664a7db1c33ae287928380e9918c771d777bf6394
|
File details
Details for the file gazi-0.1.5-py3-none-any.whl.
File metadata
- Download URL: gazi-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a0fe7c9d1b5ec15c94d3480203fd3f7671a8c70fc0015eb4e5c4585c75b1c3c
|
|
| MD5 |
d03f05a5903f2f9301dd85dd955e682c
|
|
| BLAKE2b-256 |
4c29edc8ece72653f74c1f844d2bcb6f6580f358bcdb4ec9060bee06309c1ee7
|