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.9.tar.gz
(14.2 kB
view details)
Built Distribution
File details
Details for the file Flask-RESTy-0.10.9.tar.gz
.
File metadata
- Download URL: Flask-RESTy-0.10.9.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 748dd9692bf6fc4c46132298cc34be5a6e55d2e22a65d5a573bcaecbe073cfb8 |
|
MD5 | 5e1c55ee50176b138603c9e2bba6f84a |
|
BLAKE2b-256 | 5aef819c6e0fa45b0bdd83c2906fb967b216559860116e1f0e06e737df09be0f |
File details
Details for the file Flask_RESTy-0.10.9-py2.py3-none-any.whl
.
File metadata
- Download URL: Flask_RESTy-0.10.9-py2.py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a79830f24d85f187dea50ee0ac40f787a8b01512f2f8f9512b56713ada7631a3 |
|
MD5 | 9ecf1bb5f99ca07a35c90787be5aecc5 |
|
BLAKE2b-256 | 6bba027ddc475be19b2e63159295f2f43afd7d067aee2ab7bbc7ef80dc1c4ab7 |