

def _send_request(payload=None, session=None):
    '\n    Using requests we send a SOAP envelope directly to the\n    vCenter API to reset an alarm to the green state.\n\n    :param payload:\n    :param session:\n    :return:\n    '
    stub = session
    host_port = stub.host
    url = 'https://{0}/sdk'.format(host_port)
    logging.debug('Sending {0} to {1}'.format(payload, url))
    res = requests.post(url=url, data=payload, headers={
        'Cookie': stub.cookie,
        'SOAPAction': 'urn:vim25',
        'Content-Type': 'application/xml',
    }, verify=False)
    if (res.status_code != 200):
        logging.debug('Failed to reset alarm. HTTP Status: {0}'.format(res.status_code))
        return False
    return True

dataset/ETHPy150Open vmware/pyvmomi-community-samples/samples/tools/alarm.py _send_request/original