def request(url, message, **kwargs):
    method = message['method'].lower()
    data = message.get('body', "") if method == 'post' else None
    headers = dict(message.get('headers', []))
    # If running Python 2.7.9+, disable SSL certificate validation
    req = urllib2.Request(url, data, headers)
    try:
        if sys.version_info >= (2, 7, 9):
            response = urllib2.urlopen(req, context=ssl._create_unverified_context())
        else:
            response = urllib2.urlopen(req)
    except urllib2.HTTPError, response:
        pass # Propagate HTTP errors via the returned response message
    return {
        'status': response.code,
        'reason': response.msg,
        'headers': response.info().dict,
        'body': StringIO(response.read())
    }
dataset/ETHPy150Open splunk/splunk-sdk-python/examples/handlers/handler_urllib2.py/request/original