No project description provided
Project description
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' }
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fast_header-0.1.2.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for fast_header-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f747698dda38a1a5ed14e789e9fbb379c82ee6c9ab6047518562b759cf4bf4 |
|
MD5 | 538039733dc63d369b0006b44f670432 |
|
BLAKE2b-256 | 0da4154f8ca224bb79f5050e8378a631e402d342516bb7e0427fe49d8602d542 |