This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

Flask-REST-Controller is added Class-Based-View(Controller) extension on Flask

Features

  • Follow the RESTful design
  • provide of prepare authentication and request validation
    • other class based view library is not provided of validation
  • uniform routing management
    • The existing functional view is difficult to manage. Definition routing Scattered
  • JSON Response Validation with JSON Schema
    • It would be useful for creating an API :)

Installation

$ pip install flask-rest-controller

Usage

from flask import Flask
from flask_rest_controller import Controller, set_routing

app = Flask(__name__)
app.secret_key = '͏Š|    èg<Î|ÇæãhŽÖúÈi|î°'


class JsonController(Controller):
    schema = {
        'GET': {
            'type': 'array',
            'properties': {
                'id':   {
                    'type': 'string'
                }
            }
        },
        'POST': {
            'type': 'object',
            'properties': {
                'result':   {
                    'type': 'string'
                },
                'code': {
                    'type': 'integer'
                }
            }
        }
    }

    def get(self):
        return self.render_json(["Hello World"])

    def post(self):
        return self.render_json({'result': "ok", 'code': 200})

ROUTING = [
    ("/", "app.JsonController", "json_controller"),
]

set_routing(app, ROUTING)

if __name__ == "__main__":
    app.run(debug=True)

Just save it as app.py and try

$ python app.py

Now head over to http://127.0.0.1:5000/, and you should see your hello world of json string

You should see a post request result, try this command

$ curl --request POST http://127.0.0.1:5000

You should see that you json in the post method

see https://github.com/teitei-tk/Flask-REST-Controller/tree/master/example For other examples

Dependencies

  • Python2.6 later
  • jsonschema

Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b your-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin your-new-feature)
  5. Create a new Pull Request

LICENSE

  • MIT
Release History

Release History

1.0.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Flask-REST-Controller-1.0.0.tar.gz (6.0 kB) Copy SHA256 Checksum SHA256 Source Jul 5, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting