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
You can use werkzeug for options headers https://werkzeug.palletsprojects.com/en/0.15.x/http/#werkzeug.http.parse_options_header
werkzeug
>>> import werkzeug >>> werkzeug.parse_options_header('text/html; charset=utf8') ('text/html', {'charset': 'utf8'})