def get_user(
    http_request=None,
    permissions_flag=satnet_settings.JRPC_PERMISSIONS,
    test_username=satnet_settings.TEST_USERNAME,
    testing_flag=satnet_settings.TESTING
):
    if not permissions_flag and not testing_flag:

        logger.warn(PERMISSION_EX_MSG)
        username = test_username
        user = UserProfile.objects.get(username=username)

        if user is None:
            raise Exception('User <' + username + '> could not be found.')

    else:

        user = http_request.user
        username = user.username

    return user, username
Returns the username of the user within a given HTTP request object. It
dataset/ETHPy150Open satnet-project/server/services/accounts/models.py/get_user