request.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:zippy 作者: securesystemslab 项目源码 文件源码
def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
            *, cafile=None, capath=None):
    global _opener
    if cafile or capath:
        if not _have_ssl:
            raise ValueError('SSL support not available')
        context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
        context.options |= ssl.OP_NO_SSLv2
        if cafile or capath:
            context.verify_mode = ssl.CERT_REQUIRED
            context.load_verify_locations(cafile, capath)
            check_hostname = True
        else:
            check_hostname = False
        https_handler = HTTPSHandler(context=context, check_hostname=check_hostname)
        opener = build_opener(https_handler)
    elif _opener is None:
        _opener = opener = build_opener()
    else:
        opener = _opener
    return opener.open(url, data, timeout)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号