Parse and generate Content-Disposition headers; Fork of rfc6266 with bugfixes.
This module parses and generates HTTP Content-Disposition headers. These headers are used when getting resources for download; they provide a hint of whether the file should be downloaded, and of what filename to use when saving.
This module is a fork of rfc6266 which includes the latest bugfix ‘NullHandler should be an instance, not a class’ and bumped the version to 0.0.5.
parse_headers builds a ContentDisposition object from the Content-Disposition header and (as a fallback) the document location. Shortcuts work with response objects from httplib2 and the requests library.
Important attributes of ContentDisposition are is_inline, filename_unsafe, filename_sanitized.
build_header builds a header value from a filename.
The Content-Disposition filename should be used with caution. Do not let the sender overwrite an arbitrary filesystem location, pick arbitrary extensions or filenames with special meaning, pick filenames containing unusual or misleading characters, etc. Read RFC 6266 section 4.3 for more details.
To test in the current Python implementation:
To test compatibility across Python releases:
rfc6266-parser is currently tested under Python 2.7, Python 2.6, Python 3.4, Python 3.3, and PyPy (1.7).
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size rfc6266-parser-0.0.5.post2.tar.gz (8.1 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for rfc6266-parser-0.0.5.post2.tar.gz