A micro web framework
Project description
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' )
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
burette-0.1.tar.gz
(3.9 kB
view details)
Built Distribution
burette-0.1-py3-none-any.whl
(7.3 kB
view details)
File details
Details for the file burette-0.1.tar.gz
.
File metadata
- Download URL: burette-0.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcad552b6034d31541f2c00d60c0cd8ec4c3564797de0a8b166a0b80106dd0fb |
|
MD5 | 1274fb537d71cc069febf7f78d073906 |
|
BLAKE2b-256 | 1528392ff9c13f78083a0427a7b2d7110de7d465c3bccb315eaa5decce3daa09 |
File details
Details for the file burette-0.1-py3-none-any.whl
.
File metadata
- Download URL: burette-0.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c11b11cfade526e4865646eca44c70cb97f530b74da6e5b3ebb607dbaa773261 |
|
MD5 | 890ce012714e33628c594cb70d711317 |
|
BLAKE2b-256 | 1bdfd98ed7ae7655fbad74ca9bd7f7e422994236f91bab9ff3476977e6fcac77 |