Constants for IANA message headers (http, mime, mail, etc)
Project description
Reason this exists
Wouldn't it be better to retrieve Http header information using a Http header constants, like this request_headers.get(http.REFERER). Constants such as http.REFERER for the string Referer reduces typos, and having to remember the exact spelling for Http headers.
This library does the following:
- Refers to the list of headers registered with IANA: https://www.iana.org/assignments/message-headers/message-headers.xhtml . The definitions are available for download, as CSV files. These files are present in the
referencesfolder. - Generates the headers, under the
headerspackage, using the locally available CSVreferencesfiles.
Usage
from headers import http, mime
...
request_headers.get(http.HOST) # provides access to the 'Host' header from the request
mail_headers.get(mime.Content_Location)
...
Other libraries
- 'Http lazy headers': which also provides validation, and formatting options to the values that can be set to the Headers: https://github.com/nitely/http-lazy-headers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py-message-headers-2021.7.5.tar.gz.
File metadata
- Download URL: py-message-headers-2021.7.5.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6aa52d17ee638366bb72142466e65044cbbae0ac0b318b25431c7f34a016983c
|
|
| MD5 |
c831a2ba5463f8bebce89398f0d501d6
|
|
| BLAKE2b-256 |
496e2dc716a28d84022f2d3078b7b4c9b0a321478139cd4245d21cfc4f6d32c1
|
File details
Details for the file py_message_headers-2021.7.5-py3-none-any.whl.
File metadata
- Download URL: py_message_headers-2021.7.5-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb28f2a8d6a17d6e36693e1d9eba9a03d086ee3219aba15db26e08e1d55e81d6
|
|
| MD5 |
fca8899f2fca7f2a131c4e2379179d71
|
|
| BLAKE2b-256 |
db4d2f0a950698fe298765df351d1347358308a4f9474a98d7958681cc959638
|