xmpp_request_handler.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:Deploy_XXNET_Server 作者: jzp820927 项目源码 文件源码
def _generate_chat(self, to, from_, body):
    data = _FormData()
    data.add_text('from', from_, 'plain')
    data.add_text('to', to, 'plain')
    data.add_text('body', body, 'plain')

    message_element = ElementTree.Element(
        ElementTree.QName('jabber:client', 'message'),
        {'from': from_, 'to': to, 'type': 'chat'})
    body_element = ElementTree.SubElement(
        message_element,
        ElementTree.QName('jabber:client', 'body'))
    body_element.text = body

    data.add_text('stanza',
                  ElementTree.tostring(message_element, encoding='utf-8'),
                  'xml')
    return data
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号