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.9.5.tar.gz
(12.8 kB
view details)
Built Distribution
File details
Details for the file Flask-RESTy-0.9.5.tar.gz
.
File metadata
- Download URL: Flask-RESTy-0.9.5.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c7ae21a664ea0a2875083e4765e6f80d2557848fcb6225ee6284dd46d94ddbf |
|
MD5 | 149f39a8cade098f55f7058664986da2 |
|
BLAKE2b-256 | 155be7fcd6a16b1ba39dbdc1fff84f098aed1bd5340beba92007f042cb3f1137 |
File details
Details for the file Flask_RESTy-0.9.5-py2.py3-none-any.whl
.
File metadata
- Download URL: Flask_RESTy-0.9.5-py2.py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c65be61a8b19327b9ecadd6702f359f78f69ae4e87b2902eac7503303f9f9503 |
|
MD5 | 2f70976053389aea360f65a8e1193570 |
|
BLAKE2b-256 | 7ae1620ddad17a3be679d2d5a2426e304ec99790b31d25975cf874dc62320169 |