urllib2.Request:: http Request sending successfully, but Response contains in valid data.

nRk ramesh.nrk at gmail.com
Wed Feb 11 04:56:19 EST 2009


Hi

I am trying to send Data to a website through "http" using
"urllib.request" library using the bellow code.
Response status code contains. 200 (OK) but Response contains
nothing...

With same data When I test using C# it working fine.. Response
having.. some data in xml format.
But I am using below python code i am getting response only "<HTML></
HTML>".

Is there any in my code..

 req  = urllib2.Request(url) // url is valid url
 req.add_header('Authorization','AuthSub token="xxxxxxxxxxxxx"')
 req.add_header('Content-Type','application/atom+xml')
 req.data=data  // data is having valid xml data
 r = urllib2.urlopen(req)

print(r.code) // output 200
print(r.msg) // output OK
print(r.read()) //<HTML></HTML>



More information about the Python-list mailing list