Views for your API
Project description
Flask-Pushrod is a simple helper for Flask for doing content negotiation (primarily for running the API and the website on the same code-base, with as little separate handling as possible).
Installation
Flask-Pushrod is available on PyPI, so to install the latest stable version simply run
pip install Flask-Pushrod
or
easy_install Flask-Pushrod
Usage
A simple hello world app in Pushrod would look like this:
from flask import Flask, render_template
from flask.ext.pushrod import Pushrod, pushrod_view
import random
app = Flask(__name__)
Pushrod(app)
@app.route("/")
@pushrod_view(jinja_template="hello.html")
def hello():
return {
'greeting': random.choice(("Hi", "Heya"))
}
if __name__ == "__main__":
app.run()
This would, depending on the request, return either the greeting message in JSON or render it through the Jinja2 hello.html template.
Tests
$ tox
Documentation
More advanced documentation is available on Read The Docs.
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
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 Flask-Pushrod-0.3.tar.gz.
File metadata
- Download URL: Flask-Pushrod-0.3.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7174a51da3b1d0af4dca0360b3917f1a33ab79508a2897b37a42f94f51d038b2
|
|
| MD5 |
6347a8e2993fa34ca9fb3fe03969b4e8
|
|
| BLAKE2b-256 |
cf17febcd0e774dd5c50c5db14b5db78a942ed1ba6a122c394292cb32e4f090b
|
File details
Details for the file Flask_Pushrod-0.3-py2-none-any.whl.
File metadata
- Download URL: Flask_Pushrod-0.3-py2-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcce96108e4b17d029646e7bc75e95c766a1ae80e4d9f1a30a34613cfffbbef7
|
|
| MD5 |
bf8ed4db5022b6bf492660493267f809
|
|
| BLAKE2b-256 |
a3bbf8c36f12314ac63c360d85e9628e7de5fd79bf2f216a2692a7c91fcd2fd8
|