本文整理汇总了Python中txtorcon.TorControlProtocol.get_info方法的典型用法代码示例。如果您正苦于以下问题:Python TorControlProtocol.get_info方法的具体用法?Python TorControlProtocol.get_info怎么用?Python TorControlProtocol.get_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类txtorcon.TorControlProtocol
的用法示例。
在下文中一共展示了TorControlProtocol.get_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProtocolTests
# 需要导入模块: from txtorcon import TorControlProtocol [as 别名]
# 或者: from txtorcon.TorControlProtocol import get_info [as 别名]
#.........这里部分代码省略.........
self.send(b"250-SOCKSPORT=9050")
self.send(b"250 ORPORT=0")
return d
def test_async_multiline(self):
# same as above, but i think the 650's can be multline,
# too. Like:
# 650-CIRC 1000 EXTENDED moria1,moria2 0xBEEF
# 650-EXTRAMAGIC=99
# 650 ANONYMITY=high
self.protocol._set_valid_events('CIRC')
self.protocol.add_event_listener(
'CIRC',
CallbackChecker(
"1000 EXTENDED moria1,moria2\nEXTRAMAGIC=99\nANONYMITY=high"
)
)
self.send(b"250 OK")
d = self.protocol.get_conf("SOCKSPORT ORPORT")
d.addCallback(CallbackChecker({"ORPORT": "0", "SOCKSPORT": "9050"}))
self.send(b"650-CIRC 1000 EXTENDED moria1,moria2")
self.send(b"650-EXTRAMAGIC=99")
self.send(b"650 ANONYMITY=high")
self.send(b"250-SOCKSPORT=9050")
self.send(b"250 ORPORT=0")
return d
def test_multiline_plus(self):
"""
"""
d = self.protocol.get_info("FOO")
d.addCallback(CallbackChecker({"FOO": "\na\nb\nc"}))
self.send(b"250+FOO=")
self.send(b"a")
self.send(b"b")
self.send(b"c")
self.send(b".")
self.send(b"250 OK")
return d
def test_multiline_plus_embedded_equals(self):
"""
"""
d = self.protocol.get_info("FOO")
d.addCallback(CallbackChecker({"FOO": "\na="}))
self.send(b"250+FOO=")
self.send(b"a=")
self.send(b".")
self.send(b"250 OK")
return d
def incremental_check(self, expected, actual):
if '=' in actual:
return
self.assertEqual(expected, actual)
def test_getinfo_incremental(self):
d = self.protocol.get_info_incremental(
"FOO",
functools.partial(self.incremental_check, "bar")
)
self.send(b"250+FOO=")