Skip to main content

Building blocks for REST APIs for Flask

Project description

Building blocks for REST APIs for Flask.

Coveralls

Usage

Create a SQLAlchemy model and a marshmallow schema, then:

from flask.ext.resty import Api, GenericModelView

from .models import Widget
from .schemas import WidgetSchema


class WidgetViewBase(GenericModelView):
    model = Widget
    schema = 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)

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.

Source Distribution

Flask-RESTy-0.4.0.tar.gz (9.5 kB view details)

Uploaded Source

File details

Details for the file Flask-RESTy-0.4.0.tar.gz.

File metadata

  • Download URL: Flask-RESTy-0.4.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Flask-RESTy-0.4.0.tar.gz
Algorithm Hash digest
SHA256 05442cfdc6a4221114a7e773bb9b9f5814b1f64070906d7cf6732c735439f243
MD5 bc04fc1cdce605a51f73adf01ca40f66
BLAKE2b-256 9cbebbf5497b19cb8d9641a4f26107092bb5a4ee039e030217d9cca4748b2646

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page