def basic_auth_header(username, password):
    credentials = ('%s:%s' % (username, password))
    base64_credentials = base64.b64encode(credentials.encode(HTTP_HEADER_ENCODING)).decode(HTTP_HEADER_ENCODING)
    return 'Basic %s' % base64_credentials
dataset/ETHPy150Open tomchristie/django-rest-framework/tests/test_permissions.py/basic_auth_header/original