Skip to main content

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

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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fast_header-0.1.3-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file fast_header-0.1.3.tar.gz.

File metadata

  • Download URL: fast_header-0.1.3.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.5.0

File hashes

Hashes for fast_header-0.1.3.tar.gz
Algorithm Hash digest
SHA256 312f7486d7952f7e43c9acf7a207d305fef004ff311b1cbdef23a6624a2eb81e
MD5 6fec49b84e3e2018a97bc80fff127f60
BLAKE2b-256 640709bcbf7c01e8c6cbe4ed04cf483884be4eb044b6d50433f57373a1ae9cdd

See more details on using hashes here.

File details

Details for the file fast_header-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: fast_header-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.5.0

File hashes

Hashes for fast_header-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9f0722c0a126ff4b19fd160796fd0d42efd8503516714a7d012f79f84c57d93a
MD5 ec3ea5e4488c6be0fbbc373fa9bd32f2
BLAKE2b-256 b364db25735e0cc100d148bccd78685973cf4e3cdddf92e23138af2273259128

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page