A way to create a lightning fast HTTP server using ASGI
Project description
Brisk
The fast ASGI framework
Table of Contents
Usage
Install using pip:
pip install brisk-py
Basic Example:
from brisk_py import brisk
app = brisk.App()
# simple routing
@app.get('/')
def route(request):
return '<h1>Hello World</h1>'
# render html file
@app.get('/')
def route(request):
return brisk.html('index.html')
Create an api
from brisk_py import brisk
app = brisk.App()
users = {'users': [{'user': 'John Doe', 'age': 34}, {'user': 'Jane Doe', 'age': 37}]}
@app.get('/users')
def route(request):
return users
@app.get('/user')
def route(request):
user = request.body.get('user')
if user:
return users.get(user, {'message': 'user not found'})
else:
return {'message': 'no user provided'}
@app.post('/users')
def route(request):
user = request.body.get('user')
age = request.body.get('age')
if age and user:
users.append({'user': user, 'age': age})
return {'message': 'success'}
else:
return {'message': 'error'}
Run Python in HTML
# main.py
from brisk_py import brisk
app = brisk.App()
@app.get('/')
def route(request):
fav_things = ['raindrops on roses', 'whiskers on kittens', 'bright copper kettles', 'warm woolen mittens']
return html('index.html', fav_things=fav_things)
Documentation
TBD
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
Brisk-py-0.2.0.tar.gz
(6.6 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
File details
Details for the file Brisk-py-0.2.0.tar.gz.
File metadata
- Download URL: Brisk-py-0.2.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
461f213cfc9da88307d208d6abc35dba87f5b2876660cd7d7f489d940767b2a6
|
|
| MD5 |
229fb0174e04babbdbce9fe09487b902
|
|
| BLAKE2b-256 |
5b9bf5d70768d6414cb9761a5ae95e84965b1811f0fcd7fa9255e699aad2d120
|
File details
Details for the file Brisk_py-0.2.0-py3-none-any.whl.
File metadata
- Download URL: Brisk_py-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
672b64ec9deabe60c9cff01ab1707d148d873d4a0deb7ecebb1076efc2e831e6
|
|
| MD5 |
5913b44a94d88d1d01175abe911bc12f
|
|
| BLAKE2b-256 |
ee4dfc704170320a4df9f3bec24790abac1cd1702992cede482b5f631e033302
|