

def get_imm_webclient(imm, certverify, uid, password):
    wc = webclient.SecureHTTPConnection(imm, 443, verifycallback=certverify)
    try:
        wc.connect()
    except Exception:
        return None
    adata = urllib.urlencode({
        'user': uid,
        'password': password,
        'SessionTimeout': 60,
    })
    headers = {
        'Connection': 'keep-alive',
        'Content-Type': 'application/x-www-form-urlencoded',
    }
    wc.request('POST', '/data/login', adata, headers)
    rsp = wc.getresponse()
    if (rsp.status == 200):
        rspdata = json.loads(rsp.read())
        if ((rspdata['authResult'] == '0') and (rspdata['status'] == 'ok')):
            return wc

dataset/ETHPy150Open openstack/pyghmi/pyghmi/ipmi/oem/lenovo/imm.py get_imm_webclient/original