本文整理汇总了Python中twisted.words.protocols.jabber.jid.JID.resource方法的典型用法代码示例。如果您正苦于以下问题:Python JID.resource方法的具体用法?Python JID.resource怎么用?Python JID.resource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.words.protocols.jabber.jid.JID
的用法示例。
在下文中一共展示了JID.resource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bosh_authentication
# 需要导入模块: from twisted.words.protocols.jabber.jid import JID [as 别名]
# 或者: from twisted.words.protocols.jabber.jid.JID import resource [as 别名]
def test_bosh_authentication(self):
jid = JID('[email protected]')
jid.resource = str(random.randint(0, 1000))
client = BOSHClient(jid, 'admin', 'http://localhost:5280/http-bind/')
self.assertTrue(client.startSession())
rid = client.rid
sid = client.sid
self.assertTrue(rid is not None)
self.assertTrue(sid is not None)
示例2: __call__
# 需要导入模块: from twisted.words.protocols.jabber.jid import JID [as 别名]
# 或者: from twisted.words.protocols.jabber.jid.JID import resource [as 别名]
def __call__(self, user, prot, args):
# For bare jids, we'll send what was requested,
# but also look up the user and send it to any active resources
self.ping(prot, user.jid, args)
j = JID(args)
if j.user and not j.resource:
for rsrc in scheduling.resources(args):
j.resource=rsrc
self.ping(prot, user.jid, j.full())