Skip to main content

Views for your API

Project description

Build Status

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

This version
History Node

0.3

History Node

0.2.dev

History Node

0.1.2

History Node

0.1.1

History Node

0.1

History Node

0.1.dev

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
Flask_Pushrod-0.3-py2-none-any.whl (13.2 kB) Copy SHA256 hash SHA256 Wheel py2 Jul 8, 2015
Flask-Pushrod-0.3.tar.gz (9.4 kB) Copy SHA256 hash SHA256 Source None Jul 8, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page