diff --git a/src/corelibs/requests_handling/auth_helpers.py b/src/corelibs/requests_handling/auth_helpers.py new file mode 100644 index 0000000..e46b8ea --- /dev/null +++ b/src/corelibs/requests_handling/auth_helpers.py @@ -0,0 +1,20 @@ +""" +Various HTTP auth helpers +""" + +from base64 import b64encode + + +def basic_auth(username: str, password: str) -> str: + """ + setup basic auth, for debug + + Arguments: + username {str} -- _description_ + password {str} -- _description_ + + Returns: + str -- _description_ + """ + token = b64encode(f"{username}:{password}".encode('utf-8')).decode("ascii") + return f'Basic {token}'