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
references
folder. - Generates the headers, under the
headers
package, using the locally available CSVreferences
files.
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
Close
Hashes for py-message-headers-2021.7.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aa52d17ee638366bb72142466e65044cbbae0ac0b318b25431c7f34a016983c |
|
MD5 | c831a2ba5463f8bebce89398f0d501d6 |
|
BLAKE2b-256 | 496e2dc716a28d84022f2d3078b7b4c9b0a321478139cd4245d21cfc4f6d32c1 |
Close
Hashes for py_message_headers-2021.7.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb28f2a8d6a17d6e36693e1d9eba9a03d086ee3219aba15db26e08e1d55e81d6 |
|
MD5 | fca8899f2fca7f2a131c4e2379179d71 |
|
BLAKE2b-256 | db4d2f0a950698fe298765df351d1347358308a4f9474a98d7958681cc959638 |