Skip to content

Commit

Permalink
📝 Adjust usage to recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ousret committed Mar 16, 2020
1 parent c381e39 commit 596496f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ pip install kiss-headers

### 🍰 Usage

`parse_it()` method take `bytes`, `str`, `fp` or `dict` and give you back a `Headers` object.
`parse_it()` method take `bytes`, `str`, `fp`, `dict` or even `requests.Response` itself and give you back a `Headers` object.

```python
from requests import get
from kiss_headers import parse_it

response = get('https://www.google.fr')
headers = parse_it(response.headers)
headers = parse_it(response)

'Content-Type' in headers # output: True
'Content_type' in headers # output: True
Expand All @@ -65,6 +65,10 @@ str(headers.content_type) # output : text/html; charset=ISO-8859-1
'text/html' in headers.content_type # output: True

str(headers.content_type.charset) # output : ISO-8859-1
type(headers.set_cookie) # output: list
'Secure' in headers.set_cookie[0] # output: True
'domain' in headers.set_cookie[0] # output: True
headers.set_cookie[0].domain # output: .google.fr
```

Do not forget that headers are not 1 TO 1. One header can be repeated multiple time and attribute can have multiple value within the same header.
Expand Down

0 comments on commit 596496f

Please sign in to comment.