Re: [flask] Rest with flask
- From:
- Drew Vogel
- Date:
- 2010-11-09 @ 15:21
REST doesn't require much technological support from the framework. REST is
more of an ideology. All you really need from the framework is the ability
to dispatch on the HTTP method (GET, POST, PUT, HEAD, DELETE). Flask does
support this. The @route decorator accepts an argument listing the HTTP
methods the function handles on the given route. There is an example of this
in the documentation[1]. It's also useful to be able to access arbitrary
request and response headers. I've never had to access arbitrary request
headers. I can't find any documentation about accessing arbitrary request
headers, but you can set arbitrary response headers[2].
[1] http://flask.pocoo.org/docs/quickstart/#routing (look under the HTTP
Methods heading)
[2] http://flask.pocoo.org/docs/api/#response-objects
Drew
On Tue, Nov 9, 2010 at 8:57 AM, Sebastian Matias Alvarez <
sebastianmalvarez@gmail.com> wrote:
> Does anybody have an example developing REST apps using flask?
>
> --
> Sebastián M. Alvarez
> Website: http://aseba.com.ar
> Skype: sebaalvarez
> Córdoba - Argentina
>
Re: [flask] Rest with flask
- From:
- Simon Sapin
- Date:
- 2010-11-09 @ 23:22
Le 10/11/2010 00:21, Drew Vogel a écrit :
> I've never had to access arbitrary request headers. I can't find any
> documentation about accessing arbitrary request headers,
Hi,
Request headers are in a dict-like in flask.request.headers.
flask.request is a Werkzeug Request object.
http://werkzeug.pocoo.org/documentation/dev/wrappers.html#werkzeug.BaseRequest.headers
Regards,
--
Simon Sapin
Re: [flask] Rest with flask
- From:
- Jérôme Pigeot
- Date:
- 2010-11-20 @ 07:34
Hi,
I started a little app which handle Rest resources: it's not perfect at all
but I will try to improve it in the future.
Maybe it can help you for what you need...
http://bitbucket.org/ee_lars/gra
Jérôme.