def parse_header(header_value: str, coding='utf-8') -> Tuple[str, str]:
    """Get login + password tuple from Basic Auth header value.
    """
    if header_value is None:
        raise BasicAuthException

    try:
        basic_prefix, token = header_value.strip().split(maxsplit=1)
    except AttributeError as e:
        raise BasicAuthException from e
    except ValueError as e:
        raise BasicAuthException from e

    if basic_prefix.lower() != 'basic':
        raise BasicAuthException

    return parse_token(token, coding=coding)
Get login + password tuple from Basic Auth header value.
biliup/web/http_basic_auth.py