Skip to main content

A Flask extension for easy ReSTful API generation

Project description

Flask simple REST
=========================

A Flask extansion for simple ReSTful api generation

Install
-------

For install you can use pip:
```
pip install flask_simplerest
```

Usage
-------

app.py
```
from flask import Flask
from flask.ext.simplerest import SimpleRestApp
from handlers.myhandler import MyHandler

app = Flask(__name__)
rest = SimpleRestApp(app)

MyHandler(rest, 'prefix_if_needed')

@rest('/index', 'PUT')
def some_put_method():
pass

app.run()
```

handlers/myhandler.py
```
from flask.ext.simplerest import SimpleRestResource, rest
from flask.ext.simplerest import fields

class Projects(SimpleRestResource):
@rest('/', 'POST')
def test(self, name=fields.String):
return {'name':name}

@rest('/<int:my_id>/123', 'POST')
def test2(self, my_id, name=fields.String(default='Costos')):
return dict(my_id=my_id, name=name)

```

Bash
(first you must run application)
```
curl http://127.0.0.1:5000/ -d name=Murza
{
'name': 'Murza'
}
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_simplerest-1.0.3.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file flask_simplerest-1.0.3.tar.gz.

File metadata

File hashes

Hashes for flask_simplerest-1.0.3.tar.gz
Algorithm Hash digest
SHA256 7544385b9c7eead32e043ea8773f9ae1f80b09799d516002ad54da0c16271d3b
MD5 bef7ddfe45c5ad7da2d4707cb93b18a5
BLAKE2b-256 e099ad6b27458b3b86fb5cf7e22b1b8383e804185bc34c4f311737e9ce8f229e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page