cyberbemon
cyberbemon

Reputation: 3200

Upload file to a Tomcat server using python

I have written a java servlet that uploads multiple files, I used cURL to upload the file

curl -F [email protected] http://127.0.0.1/test_Server/multipleupload this uploads the file to a folder uploads that is located in the webapps folder. I'm in the middle of writing a python module that can be used instead of curl, the reason being this server is going to be used by a build farm so using cURL is not an option and the sane goes for using pycURL. The python module I'm working on was previously written for doing this on pastebin , so all i'm doing is editing this to use my server and it looks like urllib doesn't do multipart/form-data?. If anyone could point me in the right direction it would be great, I haven't posted the code but if anyone wants it I will do so, There isn't much in that code as a start all I did was changed teh URL to my server and thats when I found out that its using application/x-www-form-urlencoded (Thank you Wireshark ! )

Upvotes: 0

Views: 751

Answers (1)

dav1d
dav1d

Reputation: 6055

You can use the Request-class to send your own headers. Maybe you wanna use requests, it makes life easier.

EDIT: uploading files with requests

Upvotes: 1

Related Questions