3

Possible Duplicate:
Recommendations of Python REST (web services) framework?

I'm looking for a RESTful Python (preferably Python 3) web framework. It should have the following things:

  • configurable URLs
  • URL generation
  • support for file uploads
  • authentication (http basic auth, cookie based)
  • content-negotiation
  • based on WSGI
  • ability to answer requests with HTTP verbs not supported by the requested resource correctly (example: if someone sends PUT but the resource only supports POST and GET, the application should answer with the allowed methods POST and GET)
  • support for caching headers
  • transform/render results

What would you recommend?

Community
  • 1
  • 1
deamon
  • 89,107
  • 111
  • 320
  • 448

4 Answers4

2

pyramid 1.3 has python 3.2 support

http://www.pylonsproject.org/projects/pyramid/about

docs: http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/

requests: http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/webob.html#request

view config decorator: http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/narr/viewconfig.html

gives the ability to write specific views for each request method to the same route e.g.

@view_config(route_name='wiki', renderer='base.pt', request_method='POST')
def view(request):
    return {'a': None}

@view_config(route_name='wiki', renderer='base.pt', request_method='PUT')
def view(request):
    return {'a': None}
daniel
  • 393
  • 1
  • 3
  • 10
2

you should glance at this link, Recommendations of Python REST (web services) framework? in this link @martin has gave really good example for developing your own rest-api. i dont know any RESTful framework which meets your all needs but you can develop your own.

and you can check Flask and Bottle. they are fast, simple and lightweight WSGI micro web-framework for Python...

Community
  • 1
  • 1
urcm
  • 2,274
  • 1
  • 19
  • 45
0

It sounds like you have a good bit of experience with HTTP. You should check out CherryPy, which is much more of an HTTP framework than a web framework. That point of view allows you to leverage HTTP in ways that the other frameworks generally try to hide from you. CherryPy can do all of the things you requested: flexible configuration is one of its selling points, and it ships with tools for caching, the Allow header, auth, and negotiation. Version 3.2 abandoned the restrictive cgi module for processing uploads and now supports upload temp files, streaming, and automatic pre-processing based on media type.

fumanchu
  • 14,419
  • 6
  • 31
  • 36
0

The non-blocking webserver and framework Tornado looks promising. It's a bit like web.py with an event driven model like the JavaScript framework node.js (but with a more convenient language). But I have not tested it yet.

deamon
  • 89,107
  • 111
  • 320
  • 448