Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python.announce > #3341 > unrolled thread
| Started by | Ahmed TAHRI <ahmed.tahri@cloudnursery.dev> |
|---|---|
| First post | 2020-03-18 10:41 +0100 |
| Last post | 2020-03-18 10:41 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python.announce
[ANN] kiss-headers, a dedicated package for reading and exploiting headers from HTTP or IMAP. With auto-completion support. Ahmed TAHRI <ahmed.tahri@cloudnursery.dev> - 2020-03-18 10:41 +0100
| From | Ahmed TAHRI <ahmed.tahri@cloudnursery.dev> |
|---|---|
| Date | 2020-03-18 10:41 +0100 |
| Subject | [ANN] kiss-headers, a dedicated package for reading and exploiting headers from HTTP or IMAP. With auto-completion support. |
| Message-ID | <158452973023.25192.python-announce-list@python.org> |
I'm thrilled to share with the community ´kiss-headers´. "Keep It Simple,
Stupid, Headers".
This idea came from the fact that I have seen so much chunk of code trying
to deal with headers, often I saw this :
charset = headers['Content-Type'].split(';')[-1].split('=')[-1].replace('"', '')
*No more of that !* 🤮
No matter your religion, IMAP4 or HTTP, you should not worry about
accessing easily header and associated attributes, adjectives or values.
Even ´psf/requests ́ represent headers with a dictionary and that is not
representative of what headers are. They are not 1 to 1. And accessing
'Content_type' should work as well as 'Content-Type'.
This package is capable of extracting original headers, unmodified and
exploitable from a Response object of requests or bytes, fp or str. It is
working on both HTTP and IMAP headers.
So that is why I decided to expose a sweet way to access them, based on the
most common needs o f the community. The license is MIT !
Take a glimpse at it : https://github.com/Ousret/kiss-headers
Hope you like it !
Back to top | Article view | comp.lang.python.announce
csiph-web