Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.

Files for flask_simplerest, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size flask_simplerest-1.0.3.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page