本文整理匯總了Python中pyxmpp.iq.Iq.set_content方法的典型用法代碼示例。如果您正苦於以下問題:Python Iq.set_content方法的具體用法?Python Iq.set_content怎麽用?Python Iq.set_content使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyxmpp.iq.Iq
的用法示例。
在下文中一共展示了Iq.set_content方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _post_connect
# 需要導入模塊: from pyxmpp.iq import Iq [as 別名]
# 或者: from pyxmpp.iq.Iq import set_content [as 別名]
def _post_connect(self):
"""Initialize authentication when the connection is established
and we are the initiator."""
if not self.initiator:
if "plain" in self.auth_methods or "digest" in self.auth_methods:
self.set_iq_get_handler("query","jabber:iq:auth",
self.auth_in_stage1)
self.set_iq_set_handler("query","jabber:iq:auth",
self.auth_in_stage2)
elif self.registration_callback:
iq = Iq(stanza_type = "get")
iq.set_content(Register())
self.set_response_handlers(iq, self.registration_form_received, self.registration_error)
self.send(iq)
return
ClientStream._post_connect(self)
示例2: submit_registration_form
# 需要導入模塊: from pyxmpp.iq import Iq [as 別名]
# 或者: from pyxmpp.iq.Iq import set_content [as 別名]
def submit_registration_form(self, form):
"""Submit a registration form.
[client only]
:Parameters:
- `form`: the filled-in form. When form is `None` or its type is
"cancel" the registration is to be canceled.
:Types:
- `form`: `pyxmpp.jabber.dataforms.Form`"""
self.lock.acquire()
try:
if form and form.type!="cancel":
self.registration_form = form
iq = Iq(stanza_type = "set")
iq.set_content(self.__register.submit_form(form))
self.set_response_handlers(iq, self.registration_success, self.registration_error)
self.send(iq)
else:
self.__register = None
finally:
self.lock.release()