[BangPypers] export methods from a python class as RESTful webservice calls

Umar Shah umar43 at gmail.com
Thu Jun 23 13:38:34 CEST 2011


thanks noufal,

I can see i am spoiled with choices. Flask looks enticing ,
SimpleHTTPServer is not a bad idea either in my case (no external
dependency).



On Thu, Jun 23, 2011 at 4:41 PM, Noufal Ibrahim <noufal at gmail.com> wrote:

> Umar Shah <umar43 at gmail.com> writes:
>
> > Hello group,
> >
> > I have used Django, Pylons for different projects before but i want
> > something minimal without overheads of MVC frameworks.
> >
> > say I have something like
> >
> > class X(object):
> >   ...
> >
> >   def A(p1, p2,...):
> >       ....
> >       return {'state':x}
> >
> >   def B(p1, p2,..):
> >       ....
> >       return {'state':y}
> >
> > I want to expose calls to A and B over HTTP.
> >
> > Assuming I do not want any more features, I was wondering is what would
> be
> > best/ efficient way to export methods A, B as RESTfull webservice calls.
>
> [...]
>
> You have quite a few options.
> 1. Use the plain old SimpleHTTPServer module and write something to
>   expose these calls.
> 2. Use a microframework like web.py or flask. A complete flask or web.py
>   app looks almost like the code you've pasted here.
> 3. Use a framework explicitly meant for writing restful services
>   (e.g. restish)
>
>
> --
> ~noufal
> http://nibrahim.net.in
>
> Everyone writes on the walls except me. -Said to be graffiti seen in
> Pompeii
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list