mirror of
https://github.com/YunoHost-Apps/django_example_ynh.git
synced 2024-09-03 18:26:21 +02:00
8 lines
260 B
Python
8 lines
260 B
Python
import base64
|
|
|
|
|
|
def generate_basic_auth(username, password):
|
|
basic_auth = f'{username}:{password}'
|
|
basic_auth_creds = bytes(basic_auth, encoding='utf-8')
|
|
creds = str(base64.b64encode(basic_auth_creds), encoding='utf-8')
|
|
return f'basic {creds}'
|