当前位置: 首页>>代码示例>>Python>>正文


Python IQ.toXml方法代码示例

本文整理汇总了Python中twisted.words.protocols.jabber.client.IQ.toXml方法的典型用法代码示例。如果您正苦于以下问题:Python IQ.toXml方法的具体用法?Python IQ.toXml怎么用?Python IQ.toXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.words.protocols.jabber.client.IQ的用法示例。


在下文中一共展示了IQ.toXml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_description

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import toXml [as 别名]
    def on_description(self, iq):
#         print(
#             'Received description from %s: %s'
#             % (iq['from'], iq.toXml().encode('utf-8')))
        pause = IQ(self.xmlstream, 'set')
        pause['to'] = iq['from']
#         enveloppe = domish.Element(
#             ('http://schemas.xmlsoap.org/soap/envelope/', 'Envelope'))
        enveloppe = domish.Element(
            ('http://schemas.xmlsoap.org/soap/envelope/', 'Envelope'), localPrefixes={'s': 'http://schemas.xmlsoap.org/soap/envelope/'})
        enveloppe['s:encodingStyle'] = "http://schemas.xmlsoap.org/soap/encoding/"
        header = domish.Element((None, 's:Header'))
#         header = domish.Element(('http://schemas.xmlsoap.org/soap/envelope/', 'Header'))
        header['mustUnderstand'] = "1"
        uc = domish.Element(('urn:schemas-upnp-org:cloud-1-0', 'uc'))
        uc['serviceId'] = 'urn:av-openhome-org:serviceId:Playlist'
        header.addChild(uc)
        enveloppe.addChild(header)
        body = domish.Element((None, 's:Body'))
#         body = domish.Element(('http://schemas.xmlsoap.org/soap/envelope/', 'Body'))
        action = domish.Element(
            ('urn:av-openhome-org:service:Playlist:1', 'Read'), localPrefixes={'u': 'urn:av-openhome-org:service:Playlist:1'})
#         action = domish.Element(
#             ('urn:av-openhome-org:service:Playlist:1', 'Pause'))
        body.addChild(action)
        enveloppe.addChild(body)
        pause.addChild(enveloppe)
        pause.addCallback(self.paused)
        print('send pause')
        print(pause.toXml())
        pause.send()
开发者ID:bverdu,项目名称:onDemand,代码行数:33,代码来源:xmpp.py

示例2: check_users

# 需要导入模块: from twisted.words.protocols.jabber.client import IQ [as 别名]
# 或者: from twisted.words.protocols.jabber.client.IQ import toXml [as 别名]
 def check_users(self):
     for user, value in self.users.items():
         if value['state'] is False:
             iq = IQ(self.xmlstream, 'set')
             query = domish.Element(('jabber:iq:roster', 'query'))
             item = domish.Element((None, 'item'))
             item['name'] = user
             item['jid'] = user
             item.addElement('group', content='hosts')
             query.addChild(item)
             iq.addChild(query)
             iq.addCallback(self.subscribe, user)
             print('send IQ: %s' % (iq.toXml().encode('utf-8')))
             iq.send()
开发者ID:bverdu,项目名称:onDemand,代码行数:16,代码来源:xmpp.py


注:本文中的twisted.words.protocols.jabber.client.IQ.toXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。