![](/img/trans.png)
[英]How to download files from a web based file server with Python Mechanize
[英]Python Web Server and File Download
我已经在Python中制作了这个简单的HTTP服务器 :
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()
我现在想做的,但我不知道怎么做的是:
当我访问http://localhost:8000/my/path/download?documentID=100
,文档(尤其是PDF文件)将开始自动下载。 当然,我有更多文档,但我希望通过get参数documentID
进行标识
最简单的方法是什么? 谢谢
您必须编写一个新的句柄。 http://fragments.turtlemeat.com/pythonwebserver.php显示了一个简单的示例。
你必须:
替代方案:
http://localhost:8000/my/path/1.pdf
向奎石致意
PS:英语不是我的母语,对不起
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.