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.5.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

Flask_RESTy-0.5.1-py2.py3-none-any.whl (14.4 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for Flask-RESTy-0.5.1.tar.gz
Algorithm Hash digest
SHA256 41af0de582fe34c6b590d1e20328dab90a3caf4fc754f370c1b7c743985177fc
MD5 042551b174365cb15f9f58872a5b2b29
BLAKE2b-256 29d91a49802d6b0f0693d34bb4e373284d98243ae8928db504fc45c31f3b8e78

See more details on using hashes here.

File details

Details for the file Flask_RESTy-0.5.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for Flask_RESTy-0.5.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9a808f739fe86416ea8e20b8b6508eb2aa8f0656b777a958841ad6bcb5b8ef35
MD5 e4bbf26ba92041b673867af324cbaf19
BLAKE2b-256 13c3d68d17538cca031427fb36940a917dbec5d1c756fcb823b7fda18e94449d

See more details on using hashes here.

Supported by

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