test status test coverage Documentation Status

This package provides a dispatcher for ripozo so that you can integrate ripozo with Flask. As with all dispatchers it is simply for getting the request arguments and appropriately routing them to the various resources for handling.

Check out the tutorial.

Or maybe the ripozo documentation.


This example describes a minimal flask-ripozo application.

from flask import Flask

from flask_ripozo import FlaskDispatcher

from ripozo.decorators import apimethod
from ripozo.dispatcher.adapters import SirenAdapter, HalAdapter
from ripozo.viewsets.resource_base import ResourceBase

class HelloWorldViewset(ResourceBase):
    _resource_name = 'myresource'     # The name of the resource.  This will be appended to
                                      # the _namespace to complete the url.

    # The decorator indicates that the base url will be used
    # and that it will be registered for GET requests
    # a GET request to /api/myresource would be dispatched to this
    # method and handled here
    def hello(cls, request, *args, **kwargs):
        faked_response_properties = {'content': 'hello world'}
        return cls(properties=filters)

# Create the flask application
app = Flask(__name__)

# Create the dispatcher
dispatcher = FlaskDispatcher(app, base_url='/api')

# Specify the valid response types
dispatcher.register_adapters(SirenAdapter, HalAdapter)

# This will register all of the apimethod decorated methods in
# this class specified.  In this case it adds the /api/myresource GET
# route to the application

if __name__ == '__main__':
    app.run() # Run the app

1.0.2 (unreleased)

  • Nothing changed yet.

1.0.1 (2015-06-30)

  • Nothing changed yet.

1.0.0 (2015-06-30)

  • Nothing changed yet.

1.0.0b1 (2015-06-29)

  • Injected argument getter. No longer attempts to automatically load json from the data.
  • Calling super on BaseDispatcher. Correctly generates AutoOptions resource.

0.1.4 (2015-05-08)

  • Using Accept-Type instead of Content-Type to get the appropriate adapter.

0.1.3 (2015-04-28)

  • Nothing changed yet.

0.1.2 (2015-04-10)

  • Nothing changed yet.

0.1.1 (2015-03-24)

  • Added the url_prefix parameter to the dispatcher initialization.

Indices and tables