HTTP Basic Auth implementation
Project description
# http-basic-auth
[![Build Status](https://travis-ci.org/bugov/http-basic-auth.svg?branch=master)](https://travis-ci.org/bugov/http-basic-auth)
Yep, it's one more HTTP Basic Auth python lib. The second. And I tried
to use the first, but it had a bug (which I fixed) and... completely
wrong realisation of non-latin encoding/decoding.
# Install
```bash
pip3 install http-basic-auth
```
# ♥️ RFC
It supports only RFC-2617 (RFC-7617 planning).
If you find some mistake – please write to [issue list 🐨](https://github.com/bugov/http-basic-auth/issues).
# ♥️ Non-latin symbols
http-basic-auth ♥ utf-8
```bash
→ curl --user name:пароль https://httpbin.org/headers
{
"headers": {
"Accept": "*/*",
"Authorization": "Basic bmFtZTrQv9Cw0YDQvtC70Yw=",
"Connection": "close",
"Host": "httpbin.org",
"User-Agent": "curl/7.54.0"
}
}
```
And even
```bash
→ curl --user 😁:пар:öль https://httpbin.org/headers
{
"headers": {
"Accept": "*/*",
"Authorization": "Basic 8J+YgTrQv9Cw0YA6w7bQu9GM",
"Connection": "close",
"Host": "httpbin.org",
"User-Agent": "curl/7.54.0"
}
}
```
All works well
```python
from http_basic_auth import generate_header, parse_header
assert "Basic 8J+YgTrQv9Cw0YA6w7bQu9GM" == generate_header('😁', 'пар:öль')
assert ('😁', 'пар:öль') == parse_header("Basic 8J+YgTrQv9Cw0YA6w7bQu9GM")
```
# Provides functions
- `generate_header`: `(user, password) → "Basic <token>"`
- `parse_header`: `"Basic <token>" → (user, password)`
- `generate_token`: `(user, password) → "<token>"`
- `parse_token`: `"<token>" → (user, password)`
[![Build Status](https://travis-ci.org/bugov/http-basic-auth.svg?branch=master)](https://travis-ci.org/bugov/http-basic-auth)
Yep, it's one more HTTP Basic Auth python lib. The second. And I tried
to use the first, but it had a bug (which I fixed) and... completely
wrong realisation of non-latin encoding/decoding.
# Install
```bash
pip3 install http-basic-auth
```
# ♥️ RFC
It supports only RFC-2617 (RFC-7617 planning).
If you find some mistake – please write to [issue list 🐨](https://github.com/bugov/http-basic-auth/issues).
# ♥️ Non-latin symbols
http-basic-auth ♥ utf-8
```bash
→ curl --user name:пароль https://httpbin.org/headers
{
"headers": {
"Accept": "*/*",
"Authorization": "Basic bmFtZTrQv9Cw0YDQvtC70Yw=",
"Connection": "close",
"Host": "httpbin.org",
"User-Agent": "curl/7.54.0"
}
}
```
And even
```bash
→ curl --user 😁:пар:öль https://httpbin.org/headers
{
"headers": {
"Accept": "*/*",
"Authorization": "Basic 8J+YgTrQv9Cw0YA6w7bQu9GM",
"Connection": "close",
"Host": "httpbin.org",
"User-Agent": "curl/7.54.0"
}
}
```
All works well
```python
from http_basic_auth import generate_header, parse_header
assert "Basic 8J+YgTrQv9Cw0YA6w7bQu9GM" == generate_header('😁', 'пар:öль')
assert ('😁', 'пар:öль') == parse_header("Basic 8J+YgTrQv9Cw0YA6w7bQu9GM")
```
# Provides functions
- `generate_header`: `(user, password) → "Basic <token>"`
- `parse_header`: `"Basic <token>" → (user, password)`
- `generate_token`: `(user, password) → "<token>"`
- `parse_token`: `"<token>" → (user, password)`
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
http-basic-auth-1.2.0.tar.gz
(3.5 kB
view details)
File details
Details for the file http-basic-auth-1.2.0.tar.gz
.
File metadata
- Download URL: http-basic-auth-1.2.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed81a9869dee608478e6477f6f3485b3b04e5378a8685a9b9170f0a7a9e90d96 |
|
MD5 | 9c3ec3a68df1a2de0fafcfc40e7452ad |
|
BLAKE2b-256 | b269711b17ef91fed31167e4c1a3088fcd892ec4b10f688306887131dfdc0f52 |