我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用urllib.request.FancyURLopener()。
def urlopen(url, data=None, proxies=None): """urlopen(url [, data]) -> open file-like object""" global _urlopener if proxies is not None: opener = urllib_request.FancyURLopener(proxies=proxies) elif not _urlopener: with support.check_warnings( ('FancyURLopener style of invoking requests is deprecated.', DeprecationWarning)): opener = urllib_request.FancyURLopener() _urlopener = opener else: opener = _urlopener if data is None: return opener.open(url) else: return opener.open(url, data)
def __init__(self): super(FancyURLopener, self).__init__()