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.2.tar.gz
(13.1 kB
view details)
Built Distribution
File details
Details for the file Flask-RESTy-0.10.2.tar.gz
.
File metadata
- Download URL: Flask-RESTy-0.10.2.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f9408af2c249aec0fb9ab12560d50b96ae56e98e46a6e21409d43c64ba340a7 |
|
MD5 | a87d2ddce2deb5d99a3e0f0e25633e59 |
|
BLAKE2b-256 | d42fa156e1095d2d0733b83ea342286d0f4a5b7614780330045249d24deb7c56 |
File details
Details for the file Flask_RESTy-0.10.2-py2.py3-none-any.whl
.
File metadata
- Download URL: Flask_RESTy-0.10.2-py2.py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18d7476ec048b5f368a21e5b2c424662a4c9da7f54e05b37e7d31d3b9e201d51 |
|
MD5 | 7d1fb7b12c970995b82b1c891d40d07a |
|
BLAKE2b-256 | 015b3d00bd4a3139f286be9a2f5780a85c55d951b98061772ad22b7ec718f665 |