[Twisted-web] how to implement render_POST?

Søren Bach Christiansen sbc at my-place.biz
Mon Jul 23 12:38:14 EDT 2007


Dos anyone have and example how to implement the different render  
function in web. Im trying to implement a REST service and I now have  
to use the render_POST.


My render_POST function looks like this:


     def render_POST(self,request):
         print request.received_headers
         print request.content.readlines()
         print request
         return "<html></html>"

but the only output i see is:

{'content-length': '134', 'content-type': 'application/x-www-form- 
urlencoded', 'host': 'sbcmac.local:8081', 'user-agent': 'Python- 
urllib/1.16'}
[]
<POST /User HTTP/1.0>


I wonder why I cant see the data I am posting. Can any of you guys  
see what im doing wrong???

ps. if anyone have a link to some example code, showing how to  
implement render_POST, render_PUT and render_DELETE I would be very  
happy


##### Client POST test code
import urllib
import sys
url = "http://sbcmac.local:8081/User"
param={'xml': """<userlist><user ContactName="Soren Bach  
Christinansen" ID="1"  UserName="sbc"/></userlist>"""}
if __name__ == '__main__':
     try:
         doc=urllib.urlencode(param)
         remote = urllib.urlopen(url,doc)
     except:
         sys.exit()


/Søren





More information about the Twisted-web mailing list