【发布时间】:2016-06-20 02:35:18
【问题描述】:
我正在使用python从网页下载文件,提交请求后,我得到如下标题:
>>> r.headers
{'Content-Disposition': 'attachment; filename="report20160619-013623.csv";',
'Content-Transfer-Encoding': 'binary', 'Expires': '0',
'Keep-Alive': 'timeout=5, max=100', 'Server': 'Apache',
'Transfer-Encoding': 'chunked', 'Connection': 'Keep-Alive', 'Pragma': 'public',
'Cache-Control': 'must-revalidate, post-check=0, pre-check=0, private',
'Date': 'Sun, 19 Jun 2016 06:35:18 GMT', 'X-Frame-Options': 'SAMEORIGIN',
'Content-Type': 'application/octet-stream'}
我的问题是如何使用request 模块下载report20160619-013623.csv。
我在网上搜索,有一些解决方案可以下载给定该文件的特定 URL 的文件,但是,在我的情况下,该文件是通过单击“下载为 excel”之类的内容在网络上生成的。我怎么知道文件在哪里?
【问题讨论】:
标签: python download python-requests