Python urllib.request 模块,proxy_bypass_environment() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用urllib.request.proxy_bypass_environment()

项目:packaging    作者:blockstack    | 项目源码 | 文件源码
def test_getproxies_environment_keep_no_proxies(self):
        self.env.set('NO_PROXY', 'localhost')
        proxies = urllib_request.getproxies_environment()
        # getproxies_environment use lowered case truncated (no '_proxy') keys
        self.assertEqual('localhost', proxies['no'])
        # List of no_proxies with space.
        self.env.set('NO_PROXY', 'localhost, anotherdomain.com, newdomain.com')
        self.assertTrue(urllib_request.proxy_bypass_environment('anotherdomain.com'))