472,958 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

How to do python and RESTful

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

Sep 5 '07 #1
6 2845
MarkyMarc 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
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
Sep 6 '07 #2
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).
Sep 6 '07 #3
On Sep 5, 9:54 pm, MarkyMarc <marcsgbrevko...@gmail.comwrote:
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

Sep 6 '07 #4
Michele Simionato <mi***************@gmail.comwrites:
On Sep 5, 9:54 pm, MarkyMarc <marcsgbrevko...@gmail.comwrote:
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,
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.
Sep 6 '07 #5
MarkyMarc 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.
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 -------------

Sep 6 '07 #6
[MarkyMarc]
>I have be looking at quixote, but is this uptodate? "plain"
mod_python, can this make url to http put,get,delete and post?
[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
Sep 6 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Jeremy Jones | last post by:
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...
1
by: SimonW | last post by:
I am building a application using XUL, and am looking at using the REST approach rather than XML-RPC for the back end. I've setup a mod-python handler which can handle PUT, DELETE, POST and GET...
2
by: mazdotnet | last post by:
Hi guys, I need some architecture design verification. We have a site on shared hosting so I can not use ISAPI filters to do any URL redirecting..etc. We need to allow our end users to access...
2
by: Guilherme Polo | last post by:
On 10/29/08, Zix <saviourms@yahoo.co.inwrote: Why did you decide to "expose" a web service through xmlrpc instead of actually exposing it by using a restful web service ? The links pointed by...
1
by: phanimadhav | last post by:
Hello Experts, I am new one of this WCF.Actually my client requirement is avoid the page load every timedropdown_selected index changes.If i select the item in dropdown based on...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.