本文整理匯總了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())