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.10.6.tar.gz
(14.1 kB
view details)
Built Distribution
File details
Details for the file Flask-RESTy-0.10.6.tar.gz
.
File metadata
- Download URL: Flask-RESTy-0.10.6.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 023170f5bbf66c00f4001f076dda97fd3e8b747eb5493a8c01f2bab8cd6f2355 |
|
MD5 | 8c58db1348c00d2872828affa8e88803 |
|
BLAKE2b-256 | 4b3a1ba83167e38465e8b2ad2bbddb99b929676e56ca2ac71bd67a0be9606ee3 |
File details
Details for the file Flask_RESTy-0.10.6-py2.py3-none-any.whl
.
File metadata
- Download URL: Flask_RESTy-0.10.6-py2.py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef07747c30176dcec2c793bcb9cef13a0176fbd476d3176e94c8ec573e5c61c7 |
|
MD5 | b336a651ef5ab00c6166025a22e70902 |
|
BLAKE2b-256 | 3e60be6330d957c92eb67ae115b7f9de5467af10d932db5be56161c32cdbd396 |