def get_jenkins_auth_handler(jenkinsuser, jenkinspass, jenkinsurl):
    """
    Get a basic authentification handler for jenkins
    :param jenkinsuser: jenkins username, str
    :param jenkinspass: jenkins password, str
    :param jenkinsurl: jenkins base url, str
    :return: a list of handlers
    """
    for param in jenkinsuser, jenkinspass, jenkinsurl:
        if param is None:
            return []
    assert type(jenkinsuser) == str, "Jenkins username should be a string, got %s" % repr(jenkinsuser)
    assert type(jenkinspass) == str, "Jenkins password should be a string, git %s" % repr(jenkinspass)
#    hostname = urlparse.urlsplit(jenkinsurl).hostname
    handler = PreemptiveBasicAuthHandler()
    handler.add_password(None, jenkinsurl, jenkinsuser, jenkinspass)
    log.debug('Adding BasicAuthHandler: url:%s, user:%s,' % (jenkinsurl, jenkinsuser))
    return [ handler ]
dataset/ETHPy150Open ramonvanalteren/jenkinsapi/jenkinsapi/utils/urlopener.py/get_jenkins_auth_handler/original