Fast Header
HTTP Header Encoder & Decoder for Python
Install
pip install fast-header
Usage
cache control
from fast_header import CacheControl
cc = CacheControl(max_stale=True)
assert cc.max_stale
assert str(cc) == "max_stable"
cc = CacheControl.parse("max_stable")
etag
from fast_header import ETag
setag = ETag(value="a") # strong etag
wetag = ETag(value="a", weak=True) # weak etag
Content Disposition
from fast_header import ContentDisposition
cd = ContentDisposition.parse('attachment; filename="=?ISO-8859-1?Q?foo-=E4.html?="')
assert cd.type == 'attachment'
assert cd.parameters == { 'filename': '=?ISO-8859-1?Q?foo-=E4.html?=' }
Content Type
from fast_header import ContentType
cd = ContentType.parse('text/html; charset=utf-8; foo=bar')
assert cd.type == 'text/html'
assert cd.parameters == { 'charset': 'utf-8', 'foo': 'bar' }
Content Range
from fast_header import ContentRange
from fast_header import ContentRange
cr = ContentRange.parse("bytes 0-20/30")
assert cr.unit == "bytes"
assert cr.range is not None
assert cr.range.start == 0
assert cr.range.stop == 20
assert cr.size == 30
Metadata
Release files for fast-header 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fast_header-0.1.3.tar.gz | 6.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fast_header-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.1 kB
Release files / fast_header-0.1.3.tar.gz
| Download URL | fast_header-0.1.3.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
312f7486d7952f7e43c9acf7a207d305fef004ff311b1cbdef23a6624a2eb81e
|
|
BLAKE2b-256 checksum How to use checksums |
640709bcbf7c01e8c6cbe4ed04cf483884be4eb044b6d50433f57373a1ae9cdd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.2 Darwin/23.5.0
|
Release files / fast_header-0.1.3-py3-none-any.whl
| Download URL | fast_header-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f0722c0a126ff4b19fd160796fd0d42efd8503516714a7d012f79f84c57d93a
|
|
BLAKE2b-256 checksum How to use checksums |
b364db25735e0cc100d148bccd78685973cf4e3cdddf92e23138af2273259128
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.2 Darwin/23.5.0
|