How to do python and RESTful

Michele Simionato michele.simionato at gmail.com
Thu Sep 6 05:18:07 EDT 2007


On Sep 5, 9:54 pm, MarkyMarc <marcsgbrevko... at gmail.com> wrote:
> Hi all,
>
> I want to make a web service application in python and keywords are
> RESTful, python and nice urls(urls mapped to python objects).
>
> I don't want a big framework but a nice small one, that can just do
> the things I want.
>
> I have be looking at quixote, but is this uptodate? "plain"
> mod_python, can this make url to http put,get,delete and post?
>
> Can some one here point me some where I can read about python and
> RESTful or have some experiences with other?
>
> Any help is apricieted.
>
> Regards Marc

For the client part, there is an easy_installable library called
restclient (which
I tested very little but it seems to work). For the server part, I am
sure there are
many available, but is also easy to write your own. For instance,
using WSGI,
you can do something like:

   def restful_wsgi_app(env, resp):
        meth = env.get('REQUEST_METHOD')
        if meth == 'GET':
            ...
        elif meth == 'POST':
            ...
        elif meth == 'PUT':
            ....
        elif meth == 'DELETE':
            ...
        else:
            raise ValueError('Unknown HTTPMethod %r!!' % meth)
        ...

      Michele Simionato




More information about the Python-list mailing list