本文整理匯總了Python中pyxmpp.jabber.client.JabberClient.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python JabberClient.__init__方法的具體用法?Python JabberClient.__init__怎麽用?Python JabberClient.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyxmpp.jabber.client.JabberClient
的用法示例。
在下文中一共展示了JabberClient.__init__方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid, password, obj):
if not jid.resource:
jid = JID(jid.node, jid.domain, "JabberRTC")
tls = TLSSettings(require = True, verify_peer = False)
auth = ['sasl:PLAIN']
JabberClient.__init__(self, jid, password, tls_settings = tls, auth_methods = auth)
self._rtobj = obj
示例2: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, *args, **kwargs):
IRCInterface.__init__(self, *args, **kwargs)
self.jid = JID(self.get_config('jid'))
password = self.get_config('pw')
#: If bare JID is provided add a resource -- it is required
if not self.jid.resource:
self.jid = JID(self.jid.node, self.jid.domain, "pyLoad")
if self.get_config('tls'):
tls_settings = streamtls.TLSSettings(require=True, verify_peer=False)
auth = ("sasl:PLAIN", "sasl:DIGEST-MD5")
else:
tls_settings = None
auth = ("sasl:DIGEST-MD5", "digest")
#: Setup client with provided connection information
#: And identity data
JabberClient.__init__(self, self.jid, password,
disco_name="pyLoad XMPP Client", disco_type="bot",
tls_settings=tls_settings, auth_methods=auth)
self.interface_providers = [
VersionHandler(self),
self,
]
示例3: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid, password, resource='Bot', tls_cacerts=None, server=None, port=5222):
# if bare JID is provided add a resource -- it is required
if isinstance(jid, basestring):
jid = JID(jid)
if not jid.resource:
jid=JID(jid.node, jid.domain, resource)
self.jid = jid
server = server or jid.domain
if tls_cacerts:
if tls_cacerts == 'tls_noverify':
tls_settings = TLSSettings(require = True, verify_peer = False)
else:
tls_settings = TLSSettings(require = True, cacert_file = tls_cacerts)
else:
tls_settings = None
# setup client with provided connection information
# and identity data
JabberClient.__init__(self, jid, password,
disco_name="PyXMPP example: echo bot", disco_type="bot",
server=None, port=None,
tls_settings=tls_settings)
# add the separate components
self.interface_providers = self.get_plugins()
self.loop_tasks = self.get_loop_tasks()
示例4: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid, password, server, port=5222, channel=None, tls_cacerts=None, listener=None):
self._jid = jid
self._server = server
self._port = port
self._channel = channel
self._listener = listener
# if bare JID is provided add a resource -- it is required
if not self._jid.resource:
self._jid=JID(self._jid.node, self._jid.domain, "Echobot")
if tls_cacerts:
if tls_cacerts == 'tls_noverify':
tls_settings = TLSSettings(require = True, verify_peer = False)
else:
tls_settings = TLSSettings(require = True, cacert_file = tls_cacerts)
else:
tls_settings = None
# setup client with provided connection information
# and identity data
JabberClient.__init__(self, jid=self._jid, password=password, disco_name="Datenverarbeitungseinheit Z45", disco_type="z45", tls_settings=tls_settings)
'''
JabberClient.__init__(self, jid, password,
disco_name="Datenverarbeitungseinheit Z45", disco_type="z45",
tls_settings = tls_settings)
'''
# add the separate components
self.interface_providers = [
VersionHandler(self),
EchoHandler(self),
]
示例5: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid, password):
if not jid.resource:
jid=JID(jid.node, jid.domain, "WeiboNotifyRobot")
tls_settings = TLSSettings(require = True, verify_peer = False)
JabberClient.__init__(self, jid, password,
disco_name="Weibo Notify Robot", disco_type="bot",
tls_settings = tls_settings, auth_methods=("sasl:PLAIN",))
示例6: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, server_jid):
jid = JID("dummy", server_jid.domain, "GetCert")
tls_settings = TLSSettings(require = True, verify_peer = False)
# setup client with provided connection information
# and identity data
JabberClient.__init__(self, jid, "",
disco_name="PyXMPP example: getcert.py", disco_type="bot",
tls_settings = tls_settings)
示例7: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid, password):
if not jid.resource:
jid=JID(jid.node, jid.domain, "Bot")
tls_settings = TLSSettings(require = True, verify_peer = False)
JabberClient.__init__(self, jid, password, auth_methods=['sasl:PLAIN'],
disco_name="Pythoner Club", disco_type="bot",
tls_settings = tls_settings)
self.interface_providers = [
DaemonHandler(self),
]
示例8: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self,jid,password,ini):
if not jid.resource:
jid=JID(jid.node,jid.domain,"rbot")
if ini:
self.ini=ini
tls=TLSSettings(require=True,verify_peer=False)
auth=['sasl:PLAIN']
JabberClient.__init__(self,jid,password,disco_name='rbot',disco_type='bot',tls_settings=tls,auth_methods=auth)
self.interface_providers=[VersionHandler(self),EchoHandler(self,ini),]
示例9: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid, password):
# if bare JID is provided add a resource -- it is required
if not jid.resource:
jid=JID(jid.node, jid.domain, "Logger")
# setup client with provided connection information
# and identity data
JabberClient.__init__(self, jid, password,
disco_name="PyXMPP Archiver bot", disco_type="bot")
# register features to be announced via Service Discovery
self.disco_info.add_feature("jabber:iq:version")
示例10: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid, password):
if not jid.resource:
jid=JID(jid.node, jid.domain, "WeiboNotifyRobot")
tls_settings = TLSSettings(require = True, verify_peer = False)
JabberClient.__init__(self, jid, password,
disco_name="Weibo Notify Robot", disco_type="bot",
tls_settings = tls_settings, auth_methods=("sasl:PLAIN",))
# add the separate components
self.interface_providers = [
CommandHandler(self),
]
示例11: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid, passwd,to_jid, message_list):
"""message_list is a list of tuples of strings, each tuple is a
sentence and it's expected reply
"""
self.messages = message_list
self.to_jid = JID(to_jid)
jid_ = JID(jid)
self.fail_count = 0
if not jid_.resource:
jid_ = JID(jid_.node, jid_.domain, "Mibot")
JabberClient.__init__(self, jid_, passwd)
self.send_next = True
self.failed_messages = []
示例12: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, config):
self.config = config
self.connection = CONNECTION.idle
self.running = True
self.jid = JID("%[email protected]%s/%s" % (config.register, config.domain, config.register))
log("register: jid:%s" % (self.jid.as_utf8(),))
tls = streamtls.TLSSettings(require=True, verify_peer=False)
auth = [ 'digest' ]
JabberClient.__init__(self, self.jid, self.config.secret,
disco_name="Vipadia Skype Gateway Register", disco_type="bot",
tls_settings=tls, auth_methods=auth)
示例13: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid = None, password = None):
super(Client, self).__init__()
if None != jid and None != password:
# if bare JID is provided add a resource
if not jid.resource:
jid = JID(jid.node, jid.domain, "XMPPMote")
JabberClient.__init__(self, jid, password,
disco_name = "XMPPMote", disco_type = "bot",
tls_settings = None)
self.interface_providers = [
VersionHandler(),
configuration.commands.get_command_handler(),
]
示例14: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, jid, password):
if not jid.resource:
jid = JID(jid.node, jid.domain, "Bot")
tls_settings = TLSSettings(require=True, verify_peer=False)
JabberClient.__init__(
self,
jid,
password,
auth_methods=["sasl:PLAIN"],
disco_name="Pythoner Club",
disco_type="bot",
tls_settings=tls_settings,
)
# add the separate components
self.interface_providers = [VersionHandler(self), BotHandler(self)]
示例15: __init__
# 需要導入模塊: from pyxmpp.jabber.client import JabberClient [as 別名]
# 或者: from pyxmpp.jabber.client.JabberClient import __init__ [as 別名]
def __init__(self, **args):
self.isconnected = False
# Create a unique jabber resource
resource = args.get('resource') or 'python_client'
resource += '_' + gethostname() + ':' + str(os.getpid()) + '_' + \
threading.currentThread().getName().lower()
self.jid = JID(args['username'], args['host'], resource)
osrf.log.log_debug("initializing network with JID %s and host=%s, "
"port=%s, username=%s" % (self.jid.as_utf8(), args['host'], \
args['port'], args['username']))
#initialize the superclass
JabberClient.__init__(self, self.jid, args['password'], args['host'])
self.queue = []
self.receive_callback = None
self.transport_error_msg = None