Skip to content

Welcome to Headers for Humans 👋

Object oriented headers, parser and builder. HTTP/1.1 Style.
PyPi Publish Action Code style: black Checked with mypy Download Count Total

kiss-headers stand for, headers, keep it sweet and simple. Principle KISS. It’s a basic library, small and concise to help you get things done regarding headers in a better way.

🔪 Features

kiss-headers is a basic library that allows you to handle headers as objects.

  • A backwards-compatible syntax using bracket style.
  • Capability to alter headers using simple, human-readable operator notation + and -.
  • Flexibility if headers are from an email or HTTP, use as you need with one library.
  • Ability to parse any object and extract recognized headers from it, it also supports UTF-8 encoded headers.
  • Fully type-annotated.
  • Provide great auto-completion in Python interpreter or any capable IDE.
  • No dependencies. And never will be.
  • 90% test coverage.

Plus all the features that you would expect from handling headers…

  • Properties syntax for headers and attribute in header.
  • Supports headers and attributes OneToOne, OneToMany and ManySquashedIntoOne.
  • Capable of parsing bytes, fp, str, dict, email.Message, requests.Response, httpx._models.Response and urllib3.HTTPResponse.
  • Automatically unquote and unfold the value of an attribute when retrieving it.
  • Keep headers and attributes ordering.
  • Case insensitive with header name and attribute key.
  • Character - equal _ in addition of above feature.
  • Any syntax you like, we like.

Note

Even if this library offers wide support to handle headers as they were objects you should know that headers are not obligated to follow any syntax. But we are pretty confident that this library cover at least 99 % of the use cases you could encounter. Feel free to address any issue you may encounter.

✨ Installation

Whatever you like, use pipenv or pip, it simply works. Requires Python 3.6+ installed.

pip install kiss-headers

📝 License

Copyright © 2020 Ahmed TAHRI @Ousret.
This project is MIT licensed.