Tornado REST API
Project description
##Tornado + Alchemy REST Client
This simple module creates CRUD endpoints for some SQLAlchemy model.
####Usage example
```python
import tornado.web
from tornado.web import URLSpec
from .models import ItemTable
from tornado_alchemy_rest import SingleRESTAPIHandler, ListRESTAPIHandler
class SingleItemHandler(SingleRESTAPIHandler):
table = ItemTable
def delete(self, *args, **kwargs):
raise HTTPError(405)
class ItemHandler(ListRESTAPIHandler):
table = ItemTable
app = tornado.web.Application([
URLSpec(prefix(r'items'), ItemHandler, dict(psql=psql_pool), 'items'),
URLSpec(prefix(r'items/(\d+)'), SingleItemHandler, dict(psql=psql_pool), 'single_item'),
])
```
This simple module creates CRUD endpoints for some SQLAlchemy model.
####Usage example
```python
import tornado.web
from tornado.web import URLSpec
from .models import ItemTable
from tornado_alchemy_rest import SingleRESTAPIHandler, ListRESTAPIHandler
class SingleItemHandler(SingleRESTAPIHandler):
table = ItemTable
def delete(self, *args, **kwargs):
raise HTTPError(405)
class ItemHandler(ListRESTAPIHandler):
table = ItemTable
app = tornado.web.Application([
URLSpec(prefix(r'items'), ItemHandler, dict(psql=psql_pool), 'items'),
URLSpec(prefix(r'items/(\d+)'), SingleItemHandler, dict(psql=psql_pool), 'single_item'),
])
```
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
Close
Hashes for tornado-alchemy-rest-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f9b110cd8f83d509c8916668e85850e3d9a6efdabcee1f12ef6f875e055af67 |
|
MD5 | a6fee55bdb3a0c7169c96d77e47f2cef |
|
BLAKE2b-256 | bc152f9eaeff2897d9148236a5e2e1e92ec522fd5b57afcbbe88b5f069fac61c |