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' }
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
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.3.tar.gz
(6.8 kB
view hashes)
Built Distribution
Close
Hashes for fast_header-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f0722c0a126ff4b19fd160796fd0d42efd8503516714a7d012f79f84c57d93a |
|
MD5 | ec3ea5e4488c6be0fbbc373fa9bd32f2 |
|
BLAKE2b-256 | b364db25735e0cc100d148bccd78685973cf4e3cdddf92e23138af2273259128 |