Registry / http-networking / pyrfc6266

pyrfc6266

JSON →
library1.0.2pypypi✓ verified 86d ago

A Python implementation of RFC 6266 for parsing Content-Disposition headers. Version 1.0.2 is the current stable release. Low release cadence; last updated in 2021.

pip install pyrfc6266
INSTALL
IMPORT
SIG · PYRFC6266
P
pyrfc6266
http-networkingpythonv1.0.2
Install
1.7s avg
Import
167ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.170s · 18.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.164s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ContentDisposition
from pyrfc6266 import ContentDisposition
Always import from top-level module; no submodules.

Parse a Content-Disposition header and extract the filename.

from pyrfc6266 import ContentDisposition header = 'attachment; filename="example.txt"' cd = ContentDisposition.parse(header) print(cd.filename_utf8) # 'example.txt' print(cd.disposition_type) # 'attachment'
Debug
Known issues
gotchaThe `filename` attribute returns the raw, possibly percent-encoded value from the header; use `filename_utf8` for the decoded UTF-8 filename.
fix
Always use `filename_utf8` instead of `filename` for human-readable filenames.
affects: <2.0
gotchaThe library does not support extended attributes like `filename*` as defined in RFC 5987. It only parses `filename` parameters.
fix
If you need RFC 5987 support, consider a different library or implement it yourself.
affects: all
Errors
Common errors & fixes
AttributeError: 'ContentDisposition' object has no attribute 'filename'
Accessing nonexistent attribute; correct attribute is 'filename_utf8' or 'raw_filename'.
fix
Use `cd.filename_utf8` instead of `cd.filename`.
ImportError: cannot import name 'parse_content_disposition' from 'pyrfc6266'
Using an incorrect function name; the correct class is `ContentDisposition`.
fix
Use `from pyrfc6266 import ContentDisposition` and call `ContentDisposition.parse(header)`.
Upgrade
Version history
1.0.2latest on PyPI · released Apr 29, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
pyrfc6266 — pip install pyrfc6266 · libregistry