使用Python下的mechanize将文件上传到Zippyshare.com

时间:2014-06-19 06:09:08

标签: python file-upload upload mechanize

我尝试使用带有Zippyshare.com的Python将文件上传到mechanize

此页面中有一个HTML上传器:http://www.zippyshare.com/sites/index_old.jsp

browser = mechanize.Browser()
browser.set_handle_robots(False)
browser.set_handle_refresh(False)
browser.addheaders = [('User-agent', 'Firefox')]
browser.open('http://www.zippyshare.com/sites/index_old.jsp')
browser.select_form(nr=1)
browser.form.add_file(open('/home/aaa.txt', 'rb'), 'text/plain', 'aaa.txt')
browser.submit()

以下脚本可以选择表单并成功执行提交操作。

但是,没有上传任何内容。

form.add_file部分有问题吗?以及如何为add_file编写正确的Zippyshare.com方法?非常感谢。

0 个答案:

没有答案
相关问题