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_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.9.3.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

Flask_RESTy-0.9.3-py2.py3-none-any.whl (19.0 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for Flask-RESTy-0.9.3.tar.gz
Algorithm Hash digest
SHA256 83a13fe389a192aa19b46d0b1330513dc5df9ed312ab2de047e54ada9dbac77c
MD5 5c3153d19ce00edb1f0586ae01b6903d
BLAKE2b-256 7f202ad2e5aa35b1740495a602752cf2c8a34a5065f618b25c09f6a20ee2d1fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Flask_RESTy-0.9.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 11a2c9e6e6e2e3bc4e906f6eba895d7d351951554e8a94de1827d594197e9469
MD5 f540732af62c0a2a8bd6c2c0845c1660
BLAKE2b-256 8795488d230983f6194c651f3c286321b607092c812468057fa1acbc81440656

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