Jonathan
Jonathan

Reputation: 21

How can I use Python with Mechanize for posting multipart/form-data?

I am using http://pypi.python.org/pypi/mechanize/0.1.11 for programmatic web browsing, I want to be able to upload files to servers the same way the browser does (by sending the content as multipart/form-data, defined in RFC2388)

Is this possible with mechanize, can you show me an example?

Thanks!

Upvotes: 2

Views: 1836

Answers (1)

Alex Martelli
Alex Martelli

Reputation: 882791

There's a couple of good answer on this SO question, one with bare mechanize and one with twill on top of it, and I believe they both end up sending multipart/form-data as you want.

Upvotes: 2

Related Questions