Python REST framework?

J

Jeremy Jones

Does anyone know if there exists a Python REST (web services) framework? I've googled and come up short. I don't think it should be that hard to do if one doesn't exist (famous last words). I guess one could subclass BaseHTTPServer and have specified things to do depending on the path and the method?


Jeremy Jones
 
W

Will Stuyvesant

[Jeremy Jones]
Does anyone know if there exists a Python REST (web services) framework?
I've googled and come up short. I don't think it should be that hard to
do ...

I'm interested. But I have been looking at the discussion on the rest
mailing list at http://groups.yahoo.com/group/rest-discuss/ and it
seems they haven't found a solution for the user:password thing yet.
Using SSL is a must, but then what? Create some unguessable URI?
That is not safe enough for banking applications etc. And using
lowlevel http stuff is also being frowned upon.

Consider creating a multiuser web-based game in a RESTful way, where
players can use a password to get access to their avatar. I haven't
figured out yet how to do such a thing according to REST, using Python
Standard Library modules.
 
D

Dave Kuhlman

Jeremy said:
Does anyone know if there exists a Python REST (web services)
framework? I've googled and come up short. I don't think it
should be that hard to do if one doesn't exist (famous last
words). I guess one could subclass BaseHTTPServer and have
specified things to do depending on the path and the method?

Not a framework, but may be of help ...

Doing REST on top of Python Web application servers like Quixote
and Twisted seems quite simple. Here is a link that might help:

http://www.rexx.com/~dkuhlman/rest_howto.html

And, here are several documents explaining how to add complex
logic to a REST application using a finite state machine (FSM)
model:

http://www.rexx.com/~dkuhlman/fsm_howto.html
http://www.rexx.com/~dkuhlman/fsmGenerate_howto.html

Dave
 
J

Jack Diederich

[Jeremy Jones]
Does anyone know if there exists a Python REST (web services) framework?
I've googled and come up short. I don't think it should be that hard to
do ...

I'm interested. But I have been looking at the discussion on the rest
mailing list at http://groups.yahoo.com/group/rest-discuss/ and it
seems they haven't found a solution for the user:password thing yet.
Using SSL is a must, but then what? Create some unguessable URI?
That is not safe enough for banking applications etc. And using
lowlevel http stuff is also being frowned upon.

Consider creating a multiuser web-based game in a RESTful way, where
players can use a password to get access to their avatar. I haven't
figured out yet how to do such a thing according to REST, using Python
Standard Library modules.

Practicality beats purity, if the only piece of state you keep is
"this guy is logged in and he authenticated as 'Bob'" then you still
get 99.99% of the cleanliness of REST. If the workarounds to make
it 100% REST-ful actually make the solution harder to use and implement
then I'll gladly be [a little bit] non REST-ty.

The point of REST is to make things easier to do and cleaner to
understand, not just so you can name drop "REST", right?

-jackdied
 
A

A.M. Kuchling

I'm interested. But I have been looking at the discussion on the rest
mailing list at http://groups.yahoo.com/group/rest-discuss/ and it
seems they haven't found a solution for the user:password thing yet.
Using SSL is a must, but then what? Create some unguessable URI?

I'm not on the rest-discuss list and therefore don't know what this is
referring to? What's wrong with returning an HTTP 401 Unauthorized error to
make the user provide a username and password?

--amk
 
V

Van Gale

Does anyone know if there exists a Python REST (web services) framework?
I've googled and come up short. I don't think it should be that hard to
do if one doesn't exist (famous last words). I guess one could subclass
BaseHTTPServer and have specified things to do depending on the path and
the method?


Jeremy Jones

Here's a nice little REST writeup with some sample Python code by Ken
MacLeod:

<http://bitsko.slc.ut.us/blog/restful-api.writeback>

Otherwise, as Dave Kuhlman mentions it's not that hard to build REST on
top of some of the existing frameworks like Quixote.

Van Gale
 
W

Will Stuyvesant

[Jack Diederich]
Practicality beats purity, if the only piece of state you keep is
"this guy is logged in and he authenticated as 'Bob'" then you still
get 99.99% of the cleanliness of REST. If the workarounds to make
it 100% REST-ful actually make the solution harder to use and implement
then I'll gladly be [a little bit] non REST-ty.

The point of REST is to make things easier to do and cleaner to
understand, not just so you can name drop "REST", right?

I thought REST was about "interoperability", a stupid word and I would
like another but my English is bad. The idea is that HTTP + XML is so
much standard that everybody can use your services.

But for some, think about people in the industry, the strongest
argument for REST is scalability. The web and email are the only
examples of *really* scalable application, where the numbers are
dozens of millions. And REST is the web's architecture.
 
V

Van Gale

Thanks for that interesting link. But I could not find the sample Python
code...

Oops, my apology! I just scanned the page *really fast* and the shell code
registered as Python. I better perform the sackcloth and ashes
ritual to regain Python purity.

Van
 
K

Kendall Grant Clark

dave> And, here are several documents explaining how to add complex
dave> logic to a REST application using a finite state machine (FSM)
dave> model:

dave> http://www.rexx.com/~dkuhlman/fsm_howto.html
dave> http://www.rexx.com/~dkuhlman/fsmGenerate_howto.html

In addition to Dave's very cool stuff, there's also Mark Nottingham's
(incomplete, last I checked) Tarawa framework, which should be easily
googlable.

Webken, while not Python (Java, iirc), is also worth a look. I also echo
other folks suggestions that Quixote makes an ideal basis for REST web
services in Python.

I recently signed on with O'Reilly to do a book about REST web services,
and since Python is my preferred language, I'm hoping to include as much
Py stuff in the book as they will let me get away with (Python book sales
being what they are, though, that may not be as much as I would like).

Kendall Clark
 

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
474,113
Messages
2,570,688
Members
47,269
Latest member
VitoYwo03

Latest Threads

Top