Building blocks for REST APIs for Flask
Project description
Building blocks for REST APIs for Flask.
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.15.2.tar.gz
(17.5 kB
view details)
Built Distribution
File details
Details for the file Flask-RESTy-0.15.2.tar.gz
.
File metadata
- Download URL: Flask-RESTy-0.15.2.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8af5a277079995ba312c8a47b99c9316b4a2f99982a408c562eb5d9405e8dcbb |
|
MD5 | 73e5f78dbbf423027a1075c132ce8105 |
|
BLAKE2b-256 | 5f422142d9569d2e18278a2c747af5c35a127fe4f3961a094c24561083b7a33c |
File details
Details for the file Flask_RESTy-0.15.2-py2.py3-none-any.whl
.
File metadata
- Download URL: Flask_RESTy-0.15.2-py2.py3-none-any.whl
- Upload date:
- Size: 25.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0238fa780040cee1ff45f5cfe77185f35b8365b7f046f5559407c59694f3bb6 |
|
MD5 | 90f6d17c933a406e871a50145bc5edca |
|
BLAKE2b-256 | 484c7a58eb092d20ac87de2aa9ed999fb65a8bdef330e86c78722192e329b8a2 |