How to do python and RESTful

M

MarkyMarc

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
 
A

Adonis Vargas

MarkyMarc said:
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

Here is a crude version, if you check out CherryPy there exists a
RESTful module for it floating around. Plus you will get the power or
CherryPy for your apps. I do not have the urls offhand but google should
yeild exactly what you need.

import BaseHTTPServer

class REST(BaseHTTPServer.BaseHTTPRequestHandler):

"""
You can implement and do_* method you want
"""

def do_GET(self):
self.wfile.write("get")

def do_POST(self):
self.wfile.write("post")

def do_PUT(self):
self.wfile.write("put")

def do_DELETE(self):
self.wfile.write("delete")

def main(server_class=BaseHTTPServer.HTTPServer, handler_class=REST):
server_address = ('', 8000)
httpd = server_class(server_address, handler_class)
httpd.serve_forever()

if __name__ == '__main__':
main()

Not fully tested but should get on your feet.

Hope this helps.

Adonis Vargas
 
B

Bruno Desthuilliers

MarkyMarc a écrit :
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?
You may want to have a look at Pylons (http://pylonshq.com).
 
M

Michele Simionato

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
 
S

Stefan Arentz

Michele Simionato said:
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,

Another good option is Twisted. The Twisted book from O'Reilly has
examples of using the twisted HTTP client as a REST client. I'm using
that fairly succesful.

S.
 
S

Steve Holden

MarkyMarc said:
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.
Translation: I am only interested in a solution that has anticipated my
needs almost exactly. [?]
I have be looking at quixote, but is this uptodate? "plain"
mod_python, can this make url to http put,get,delete and post?
Would you care to explain why quixote needs to be "uptodate"? Surely it
either does what you want or it doesn't? If it dies, then it hardly
matters how "up to date" it is. Are you also concerned that some parts
of Python remains unchanged since before 1.5.2, now almost tne years old?
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.
I hope you don't regard this as being unhelpful. I would encourage you
to focus on finding a system that meets your (functionality)
requirements. If you want "up to date" then C# is that way ---> ;-)

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
 
T

Tim Golden

[MarkyMarc]
[Steve Holden]
Would you care to explain why quixote needs to be "uptodate"? Surely it
either does what you want or it doesn't? If it dies, then it hardly
matters how "up to date" it is. Are you also concerned that some parts
of Python remains unchanged since before 1.5.2, now almost tne years old?

FWIW, I have used Quixote on two (v. small-scale) production websites,
both started several years ago when there were fewer web toolkits in
the Python universe. Every so often I consider reworking one or other
of them into one of the newer (read: more recently noised about)
toolkits/frameworks. But they work fine as they are, so why bother?
As a matter of fact, one uses Quixote v1, the other uses v2 which
occasionally throws me when I'm doing some work on both at the same
time!

TJG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top