Skip to main content


Project description

flask-ripozo 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.


This example describes a minimal flask-ripozo application.

from flask import Flask

from flask_ripozo import FlaskDispatcher

from ripozo.decorators import apimethod
from ripozo.viewsets.resource_base import ResourceBase

from ripozo_tests.helpers.inmemory_manager import InMemoryManager

class Manager(InMemoryManager):
    # This is just for test purposes.
    # In real applications you would want to use
    # something like ripozo-sqlalchemy to actually
    # manage your models.  Also in future
    # versions of ripozo a Manager class will
    # not be required for a Resource class
    model = 'SomeModel'
    _model_name = 'modelname'

class HelloWorldViewset(ResourceBase):
    _namespace = '/api/'              # The base url of the resource
    _manager = Manager                # This should not be required in future versions of ripozo
    _resource_name = 'myresource'     # The name of the resource.  This will be appended to
                                      # the _namespace to complete the url.

    _fields = ['content']             # Necessary because the _manager is necessary.  Will
                                      # be removed in future versions

    # 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, primary_keys, filters, values, *args, **kwargs):
        faked_response_properties = {'content': 'hello world'}
        return cls(properties=filters)

app = Flask(__name__)  # Create the flask application

# Create the dispatcher
# A flask blueprint could also be used here.s
dispatcher = FlaskDispatcher(app)

# 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__': # Run the app

Project details

Download files

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

Files for flask-ripozo, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size flask-ripozo-0.1.0.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

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