Skip to main content

Building blocks for REST APIs for Flask

Project description

Flask-RESTy Travis Codecov PyPI marshmallow 3 compatible

Flask-RESTy provides building blocks for creating REST APIs with Flask, SQLAlchemy, and marshmallow.

from flask_resty import Api, GenericModelView

from . import app, models, schemas

class WidgetViewBase(GenericModelView):
    model = models.Widget
    schema = schemas.WidgetSchema()

class WidgetListView(WidgetViewBase):
    def get(self):
        return self.list()

    def post(self):
        return self.create()

class WidgetView(WidgetViewBase):
    def get(self, id):
        return self.retrieve(id)

    def patch(self, id):
        return self.update(id, partial=True)

    def delete(self, id):
        return self.destroy(id)

api = Api(app, "/api")
api.add_resource("/widgets", WidgetListView, WidgetView)


Documentation is available at


MIT Licensed. See the bundled LICENSE file for more details.

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.

Files for Flask-RESTy, version 1.3.0
Filename, size File type Python version Upload date Hashes
Filename, size Flask_RESTy-1.3.0-py3-none-any.whl (37.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Flask-RESTy-1.3.0.tar.gz (30.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page