本文整理汇总了Python中xmlrpclib.Transport.make_connection方法的典型用法代码示例。如果您正苦于以下问题:Python Transport.make_connection方法的具体用法?Python Transport.make_connection怎么用?Python Transport.make_connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpclib.Transport
的用法示例。
在下文中一共展示了Transport.make_connection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_connection
# 需要导入模块: from xmlrpclib import Transport [as 别名]
# 或者: from xmlrpclib.Transport import make_connection [as 别名]
def make_connection(self, host):
self.realhost = host
proxies = urllib.getproxies()
proxyurl = None
if 'http' in proxies:
proxyurl = proxies['http']
elif 'all' in proxies:
proxyurl = proxies['all']
if proxyurl:
urltype, proxyhost = urllib.splittype(proxyurl)
host, selector = urllib.splithost(proxyhost)
h = httplib.HTTP(host)
self.proxy_is_used = True
return h
else:
self.proxy_is_used = False
return Transport.make_connection(self, host)
示例2: make_connection
# 需要导入模块: from xmlrpclib import Transport [as 别名]
# 或者: from xmlrpclib.Transport import make_connection [as 别名]
def make_connection(self, host):
"""Create the connection for the transport and save it."""
self.conn = Transport.make_connection(self, host)
return self.conn
示例3: make_connection
# 需要导入模块: from xmlrpclib import Transport [as 别名]
# 或者: from xmlrpclib.Transport import make_connection [as 别名]
def make_connection(self, host):
conn = Transport.make_connection(self, host)
conn.timeout = self._timeout
return conn