Burette
A micro web framework for python3.
HelloWorld
Here is an example of the HelloWorld.
from burette import Burette
app = Burette()
@app.route('/hello/world')
def helloworld():
return "Hello World!"
if __name__ == '__main__':
app.run_local()
Routing
Here are some routing examples.
# /hello/Jack -> "Hello Jack"
@app.route('/hello/<yourname>')
def hello_path(request):
return "Hello " + request.path_params.get('yourname')
# /hello?yourname=Ken -> "Hello Ken"
@app.route('/hello')
def hello_querystring(request):
return "Hello " + request.params.get('yourname')
# POST and PUT
@app.route('/hello_post', method='POST')
def hello_post(request):
return "Hello " + request.text
Redirecting
from burette import redirect
@app.route('/redirect')
def redirect_example():
return redirect('/to/path')
JSON
Sometimes you may want to return json to the client. Just return a dictionary for that.
@app.route('/json')
def get_json():
return {'key': 'value'}
Jinja2 integration
from burette import jinja2
@app.route('/jinja2')
def jinja():
return jinja2('foo.tpl', myvar={'url': 'http://www.example.com', 'name': 'Example'}, template_path='./templates' )
Metadata
Release files for burette 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| burette-0.1.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| burette-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / burette-0.1.tar.gz
| Download URL | burette-0.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcad552b6034d31541f2c00d60c0cd8ec4c3564797de0a8b166a0b80106dd0fb
|
|
BLAKE2b-256 checksum How to use checksums |
1528392ff9c13f78083a0427a7b2d7110de7d465c3bccb315eaa5decce3daa09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
|
Release files / burette-0.1-py3-none-any.whl
| Download URL | burette-0.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c11b11cfade526e4865646eca44c70cb97f530b74da6e5b3ebb607dbaa773261
|
|
BLAKE2b-256 checksum How to use checksums |
1bdfd98ed7ae7655fbad74ca9bd7f7e422994236f91bab9ff3476977e6fcac77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
|