For some reasons, i need use the Python httplib module instead of pycurl.

Here is my code:
import httplib
import urllib


params=urllib.urlencode({"@op":"CREATE","@user.name":"levi"})
headers={"Content-type": "application/x-www-form-urlencoded","Accept": 
"text/plain"}
conn=httplib.HTTPConnection("localhost:50070")
conn.request("PUT","/webhdfs/v1/levi/7.txt",params,headers)
response=conn.getresponse()
print response.status, response.reason
data=response.read()




OK, but my return is:
#print response.status, response.reason
500 Internal Server Error
#print data
'{"RemoteException":{"exception":"WebApplicationException","javaClassName":"javax.ws.rs.WebApplicationException","message":null}}'


Who knows why? It's OK when i use curl, so where is the problem in httplib 
method?
Or some other reasons?

Reply via email to