本文整理汇总了Python中options.Options.get_proxies方法的典型用法代码示例。如果您正苦于以下问题:Python Options.get_proxies方法的具体用法?Python Options.get_proxies怎么用?Python Options.get_proxies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类options.Options
的用法示例。
在下文中一共展示了Options.get_proxies方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_proxy
# 需要导入模块: from options import Options [as 别名]
# 或者: from options.Options import get_proxies [as 别名]
def test_proxy(self):
dictionary = {}
o = Options(dictionary)
self.assertDictEqual({}, o.get_proxies())
dictionary = {'proxies': {'http': 'http://user:[email protected]:1080'}}
o = Options(dictionary)
self.assertDictEqual({'http': 'http://user:[email protected]:1080'}, o.get_proxies())
dictionary = {'proxies': {'http': 'http://user:[email protected]:1080', 'https': 'http://10.10.1.10:1080'}}
o = Options(dictionary)
self.assertDictEqual(
{'http': 'http://user:[email protected]:1080', 'https': 'http://10.10.1.10:1080'},
o.get_proxies()
)
示例2: test_update_proxy
# 需要导入模块: from options import Options [as 别名]
# 或者: from options.Options import get_proxies [as 别名]
def test_update_proxy(self):
config_file_proxy = {'http': 'http://user:[email protected]:1080'}
cli_proxy = {'http': 'http://10.10.1.10:1080'}
dictionary = {'proxies': config_file_proxy}
# Don't overwrite a proxy if dictionary doesn't include a 'proxy' value
o = Options(dictionary)
o.update_from_cli_arguments({})
self.assertEqual(config_file_proxy, o.get_proxies())
o = Options(dictionary)
o.update_from_cli_arguments({'proxy': []})
self.assertEqual(config_file_proxy, o.get_proxies())
o = Options(dictionary)
o.update_from_cli_arguments({'proxy': cli_proxy})
self.assertEqual({'http': 'http://10.10.1.10:1080'}, o.get_proxies())
示例3: test_defaults
# 需要导入模块: from options import Options [as 别名]
# 或者: from options.Options import get_proxies [as 别名]
def test_defaults(self):
dictionary = {}
o = Options(dictionary)
self.assertDictEqual({}, o.get_proxies())
self.assertTrue(o.get_verify())