本文整理汇总了Python中twisted.names.srvconnect.SRVConnector.pickServer方法的典型用法代码示例。如果您正苦于以下问题:Python SRVConnector.pickServer方法的具体用法?Python SRVConnector.pickServer怎么用?Python SRVConnector.pickServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.names.srvconnect.SRVConnector
的用法示例。
在下文中一共展示了SRVConnector.pickServer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pickServer
# 需要导入模块: from twisted.names.srvconnect import SRVConnector [as 别名]
# 或者: from twisted.names.srvconnect.SRVConnector import pickServer [as 别名]
def pickServer(self):
if self.override is None:
overriddenHost, overriddenPort = None, None
else:
overriddenHost, overriddenPort = self.override
if (overriddenHost is not None
and (overriddenPort is not None
or self.domain is None)):
host = overriddenHost
port = overriddenPort
else:
host, port = SRVConnector.pickServer(self)
if overriddenHost is not None:
host = overriddenHost
if overriddenPort is not None:
port = overriddenPort
try:
port = int(port)
except ValueError:
pass
assert host is not None
if port is None:
port = 389
return host, port
示例2: pickServer
# 需要导入模块: from twisted.names.srvconnect import SRVConnector [as 别名]
# 或者: from twisted.names.srvconnect.SRVConnector import pickServer [as 别名]
def pickServer(self):
host, port = SRVConnector.pickServer(self)
if not self.servers and not self.orderedServers:
# no SRV record, fall back..
port = int(config()['xmpp']['port'])
return host, port
示例3: pickServer
# 需要导入模块: from twisted.names.srvconnect import SRVConnector [as 别名]
# 或者: from twisted.names.srvconnect.SRVConnector import pickServer [as 别名]
def pickServer(self):
host, port = SRVConnector.pickServer(self)
if not self.servers and not self.orderedServers:
# no SRV record, fall back..
port = 5222
return host, port
示例4: pickServer
# 需要导入模块: from twisted.names.srvconnect import SRVConnector [as 别名]
# 或者: from twisted.names.srvconnect.SRVConnector import pickServer [as 别名]
def pickServer(self):
assert self.servers is not None
assert self.orderedServers is not None
if not self.servers and not self.orderedServers:
# no SRV record, fall back..
return self.domain, 2855
return SRVConnector.pickServer(self)
示例5: pickServer
# 需要导入模块: from twisted.names.srvconnect import SRVConnector [as 别名]
# 或者: from twisted.names.srvconnect.SRVConnector import pickServer [as 别名]
def pickServer(self):
"""
Pick a server and port to make the connection.
"""
host, port = SRVConnector.pickServer(self)
if port == 5223 and ssl:
context = ssl.ClientContextFactory()
context.method = ssl.SSL.SSLv23_METHOD
self.connectFuncName = 'connectSSL'
self.connectFuncArgs = (context,)
return host, port
示例6: pickServer
# 需要导入模块: from twisted.names.srvconnect import SRVConnector [as 别名]
# 或者: from twisted.names.srvconnect.SRVConnector import pickServer [as 别名]
def pickServer(self):
"""
Pick a server and port to make the connection.
"""
host, port = SRVConnector.pickServer(self)
if not self.servers and not self.orderedServers:
# no SRV record, fall back..
port = 5222
if port == 5223 and xmlstream.ssl:
context = xmlstream.ssl.ClientContextFactory()
context.method = xmlstream.ssl.SSL.SSLv23_METHOD
self.connectFunc = 'connectSSL'
self.connectFuncArgs = (context)
return host, port
示例7: pickServer
# 需要导入模块: from twisted.names.srvconnect import SRVConnector [as 别名]
# 或者: from twisted.names.srvconnect.SRVConnector import pickServer [as 别名]
def pickServer(self):
host, port = SRVConnector.pickServer(self)
print('Resolved _%s._%s.%s --> %s:%s' % (self.service, self.protocol, self.domain, host, port))
return host, port
示例8: pickServer
# 需要导入模块: from twisted.names.srvconnect import SRVConnector [as 别名]
# 或者: from twisted.names.srvconnect.SRVConnector import pickServer [as 别名]
def pickServer(self):
host, port = SRVConnector.pickServer(self)
if not self.servers and not self.orderedServers:
port = 5222
return host, port