How to get pdf filename with Python requests?

后端 未结 5 730
渐次进展
渐次进展 2020-12-09 08:16

I\'m using the Python requests lib to get a PDF file from the web. This works fine, but I now also want the original filename. If I go to a PDF file in Firefox and click

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-09 08:20

    Apparently, for this particular resource it is in:

    r.headers['content-disposition']
    

    Don't know if it is always the case, though.

提交回复
热议问题