+ -
当前位置:首页 → 问答吧 → 请问pyxmpp下如何向openfire服务器注册?

请问pyxmpp下如何向openfire服务器注册?

时间:2011-12-22

来源:互联网

下载了这个基于XMPP的开源协议python实现的,demo里面并没有关于注册的实现例子,自己写了个,但是传递参数时一直存在问题,想请教下研究过pyxmpp的筒子们,谢谢啦
from pyxmpp.jabber.dataforms import Form
from pyxmpp.jabber.client import JabberClient
from pyxmpp2.iq import Iq
form=Form(title='register',fields=['username','password'])
iq=Iq(from_jid='[email protected]',to_jid='10.2.45.153',stanza_type='set')

jabberclient=JabberClient()

jabberclient.process_registration_form(iq,form)
以上问题出现在fields这个问题上,fields该填何字段,以下是Form类的定义格式


  :Ivariables:
  - `type`: form type ("form", "submit", "cancel" or "result").
  - `title`: form title.
  - `instructions`: instructions for a form user.
  - `fields`: the fields in the form.
  - `reported_fields`: list of fields returned in a multi-item data form.
  - `items`: items in a multi-item data form.
  :Types:
  - `title`: `unicode`
  - `instructions`: `unicode`
  - `fields`: `list` of `Field`
  - `reported_fields`: `list` of `Field`
  - `items`: `list` of `Item`
  """

作者: jyjyjy1987   发布时间: 2011-12-22

热门下载

更多