[Twisted-web] newb: Twisted and API for Web Services
L. Daniel Burr
ldanielburr at mac.com
Thu Mar 22 15:05:55 CST 2007
On Thu, 22 Mar 2007 15:45:25 -0500, Ram Peters <rampeters at gmail.com> wrote:
> Question1: How do I distinguish the request in Twisted web for each
> uri and call the appropriate class to handle the request, and response
> back a xml data?
>
See
http://twistedmatrix.com/projects/web/documentation/howto/using-twistedweb.html#resources
At the url mentioned above, pay attention to the parts about getChild
and putChild.
If you are using twisted.web2, then see
http://twistedmatrix.com/projects/web2/documentation/howto/object-traversal.xhtml
> Question2: It will be listening on port 8080. How does this get
> translated to url?
>
> For example, my URI as follows:
> http://api.example.org/auto/Ford
> http://api.example.org/auto/Chevy
> http://api.example.org/auto/add
> http://api.example.org/auto/delete
> http://api.example.org/dealer/inventory
> http://api.example.org/dealer/invoice
>
If your server is listening on port 8080, your URLs will look like this:
http://api.example.org:8080/auto/Ford
http://api.example.org:8080/auto/Chevy
http://api.example.org:8080/auto/add
http://api.example.org:8080/auto/delete
http://api.example.org:8080/dealer/inventory
http://api.example.org:8080/dealer/invoice
Hope this helps,
L. Daniel Burr
More information about the Twisted-web
mailing list