Python 下载对应文件服务器的response该怎么写,pythonresponse,@route(/down
Python 下载对应文件服务器的response该怎么写,pythonresponse,@route(/down
@route('/download/<hash>')def download_file(hash): pass
bottle.py 如何提供文件下载
比如写成这种restful形式, 当用户访问带hash的连接的时候下载对应文件, 服务器的response该怎么写?
@route('/download/<filename:path>')def download(filename): return static_file(filename, root='/path/to/static/files', download=filename)
文档中不是有示例了么?打开 http://bottlepy.org/docs/dev/tutorial.html#generating-content 搜 Force Download.
除了static_file之外,还可以直接return 字符串就行,如果要具体设置content-type之类的,可以修改bottle.response的相关属性
编橙之家文章,
相关内容
- xml文件很大python方法提取节点中多行文本怎么办,xml
- 说Python多线程是伪命题正确吗?,python多线程伪命题,我
- Python用mysql.connector select报错如何解决,,python中使用m
- Python什么方法可以将多行unicode字符串前u去除,pythonu
- 正则匹配出每一条记录后面的python字符串,怎么做?,
- Ruby语言对于研究网络安全方面会有提升吗?,ruby网络安
- Django写博客model关于这块该怎么写,djangomodel,初学编程
- Python第三方模块中有限制频率的模块吗,python第三方
- Python将字典转成scipy sparse matrix求方法,scipysparse,我的数
- 求指导python spark读入文件不能正常载入的原因,python
评论关闭