Trouble sending / receiving compressed data (using zlib) as HTTP POST to server (in django)
subeen
tamim.shahriar at gmail.com
Sun Oct 4 14:59:27 EDT 2009
Thanks for your response.
> How did you post the data? If you post binary data you should indicate
> this with a proper mime type, like application/octet-stream. Otherwise
> it might be interpreted as text which it isn't.
> --
I am trying to send the data using following code:
...
opener = urllib2.build_opener()
opener.addheaders = [
('User-Agent', 'python'),
('Content-Type', 'application/octet-stream'),
]
data = zlib.compress(data)
params = urllib.urlencode({'uid': uid, 'reqid': rid, 'data':
data})
usock = opener.open(url, params)
resp = usock.read()
usock.close()
...
regards,
Subeen.
More information about the Python-list
mailing list