Skip to main content

Building blocks for REST APIs for Flask

Project description

Building blocks for REST APIs for Flask.

Codecov

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Flask_RESTy-0.17.0-py2.py3-none-any.whl (26.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for Flask-RESTy-0.17.0.tar.gz
Algorithm Hash digest
SHA256 54f53df465c4f935caf7669c01d6295568a006d14f5b6d0a07177064b9d1e8f0
MD5 9d20a69e7effa7c034f5649a6aa7b792
BLAKE2b-256 51c20e6a7c8925ced795ea40b6d5631ee3fbc87171874086171a1045ccb24bfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Flask_RESTy-0.17.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3b7490a669e9d8c87f7831f03509c3eb59c55b8b86e5ee34f564db87a9bad9fb
MD5 1c21e6c99bf98c295b8182ea21cbda1a
BLAKE2b-256 9bf015c1a2bd04ff229cc14f4f5637f44cba1592e606aa68fcbbe7b8151d6cda

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