Hi All,
Let me start by saying that's I'm relatively new to Python, so please
be gentle!
I need to up upload a file to a Tomcat web app using httplib. The web
app requires the following:
Files need to be split into 100kb (102400b) and each file segment
loaded using the PUT request. It is also a requirement that the
following headers be sent:
For simplicity I've used an image (jpg) smaller than 100kb, so it
doesn't need to be chunked
headers = {
"Accept": "text/xml",
"Authorization": "testAuthHeader",
"Content-Length": 50172,
"Content-Range": "bytes 0-50172/50172",
"Content-Type": "image/jpeg",
"If-Match": "1",
"User-Agent": "(en-IE; Grinder)",
}
I make the following connection:
conn = httplib.HTTPConnection(url)
conn.request(method, uriStr, body, additionalHeaders)
where:
method = PUT
uriStr is the web app specific URI
body is the raw data (bytes) from the jpg image
additionalHeaders are the headers above
For some reason I keep getting a Status 400 error from the web server.
Is it possible to PUT (or POST?) data in this fashion using httplib?
Many thanks for your help
Noelob
--
http://mail.python.org/mailman/listinfo/python-list