本文整理汇总了Python中xmlrpclib.ServerProxy.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ServerProxy.__init__方法的具体用法?Python ServerProxy.__init__怎么用?Python ServerProxy.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpclib.ServerProxy
的用法示例。
在下文中一共展示了ServerProxy.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, config, notebook):
self.name = 'DokuWiki'
self.notebook = notebook
# Configuration
self.url, username, pwd = config.get(self.name, self.notebook).split(';')
ServerProxy.__init__(self, self.url + '/lib/exe/xmlrpc.php?' + urlencode({'u':username, 'p':pwd}))
示例2: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, host, client_name, version="1_0_0_0"):
self.version = version
self.client_name = client_name
if self.version == "1_0_0_0":
try:
ServerProxy.__init__(self, host, allow_none=True)
except Error, v:
print "CONNECTION ERROR", v
示例3: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, child_command, debug=False):
"""
if debug is True, all communication will be
logged to sys.stderr
"""
self.transport = EnsembleTransport(
self.connect(child_command, debug))
ServerProxy.__init__(self, "http://ensemble/", # just to avoid error
transport=self.transport)
示例4: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__ (self, username=False, password=False, prog_name=False, verbose=False):
if not (username and password and prog_name):
raise SipgateAPIException('To use the class sipgate.api you must provide, username, password and a program name.')
address = SIPGATE_API_URL % {'username':username, 'password':password}
### The super() call would be more modern but it doesn't work with the current Python version yet.
#super(api, self).__init__(address, verbose=debug)
ServerProxy.__init__(self, address,verbose=verbose)
### It is considered good practice to Identify the client talking to the server:
self.ClientIdentify({ "ClientName" : NAME % prog_name, "ClientVersion" : VERSION, "ClientVendor" : VENDOR })
示例5: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, uri, encoding=None, verbose=0, allow_none=0,
use_datetime=0, cookiejar=None):
if cookiejar is None:
cookiejar = CookieJar()
transport = RequestTransport(use_datetime=use_datetime, uri=uri,
cookiejar=cookiejar)
ServerProxy.__init__(self, uri=uri, transport=transport,
encoding=encoding, verbose=verbose, allow_none=allow_none,
use_datetime=use_datetime)
示例6: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, _servaddr, TLS = False, certificatePath = '', S = None):
_addr = _servaddr.split(':')
enable_proxy(str(_addr[0]), S)
if TLS :
servaddr = 'https://' + _servaddr
else :
servaddr = 'http://' + _servaddr
ServerProxy.__init__(self, servaddr)
self.Ready = False
addr = (str(_addr[0]), int(_addr[1]))
self.socketInit(addr, TLS, certificatePath)
if writeSocketReady(self.socket, TIMEOUT) :
self.Ready = True
示例7: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, context):
preference_tool = getToolByName(context, 'portal_preferences')
address = preference_tool.getPreferredOoodocServerAddress()
port = preference_tool.getPreferredOoodocServerPortNumber()
if address in ('', None) or port in ('', None) :
raise ConversionError('OOoDocument: cannot proceed with conversion:'
' conversion server host and port is not defined in preferences')
uri = 'http://%s:%d' % (address, port)
timeout = preference_tool.getPreferredOoodocServerTimeout() \
or OOO_SERVER_PROXY_TIMEOUT
transport = TimeoutTransport(timeout=timeout, scheme='http')
ServerProxy.__init__(self, uri, allow_none=True, transport=transport)
示例8: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, *args, **kw):
"""All unknown arguments are passed to xmlrpc.ServerProxy.__init__
Specific to SklikProxy:
loglevel - debug log level, 0 - no logging, 2 - full logging [0]
exceptions - if True raise exceptions when status != 200 [False]
"""
self.__session = None
self.__debug = kw.pop('loglevel', 0)
self.__exceptions = kw.pop('exceptions', False)
kw.setdefault('allow_none', True)
ServerProxy.__init__(self, *args, **kw)
示例9: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self.stopped = False
from Plugins.Extensions.SeriesPlugin.plugin import REQUEST_PARAMETER
uri = config.plugins.seriesplugin.serienserver_url.value + REQUEST_PARAMETER
import ssl
if hasattr(ssl, '_create_unverified_context'):
ssl._create_default_https_context = ssl._create_unverified_context
ServerProxy.__init__(self, uri, verbose=False, *args, **kwargs)
timeout = config.plugins.seriesplugin.socket_timeout.value
socket.setdefaulttimeout( float(timeout) )
self.skip = {}
示例10: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, uri=None, ca_certs=None, keyfile=None, certfile=None,
cert_reqs=ssl.CERT_REQUIRED, ssl_version=ssl.PROTOCOL_TLSv1,
transport=None, encoding=None, verbose=0, allow_none=0, use_datetime=0,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT, strict=None):
if not transport:
_transport=SSLClientTransport(ca_certs, keyfile, certfile, cert_reqs,
ssl_version, timeout, strict)
else:
_transport=transport(ca_certs, keyfile, certfile, cert_reqs,
ssl_version, timeout, strict)
ServerProxy.__init__(self, uri, _transport, encoding, verbose,
allow_none, use_datetime)
self.logger = logging.getLogger(self.__class__.__name__)
示例11: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, logger, url, ssl_config):
keywords = {}
if url.startswith('https'):
# Choose the right SSL Transport (depend on xmlrpclib version)
import xmlrpclib
if hasattr(xmlrpclib, 'GzipDecodedResponse'):
# XML-RPC backport enabled: use our SSL transport, compatible
# with the new XML-RPC library API
from ufwi_rpcd.common.ssl.transport import SSL_Transport
else:
from M2Crypto.m2xmlrpclib import SSL_Transport
# Use M2Crypto transport
context = ssl_config.createContext(logger)
keywords['transport'] = SSL_Transport(context)
else:
logger.critical("WARNING: Unsafe cleartext connection (HTTP)")
ServerProxy.__init__(self, url, **keywords)
示例12: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, host=None):
if not host:
host = config.raspi2
ServerProxy.__init__(self, 'http://{}:{}'.format(host, PORT))
示例13: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__ (self, address, username=None, password=None, language='en', verbose=False):
self.__address = address
#super(domrobot, self).__init__(address, transport=InwxTransport(), encoding = "UTF-8", verbose=verbose)
ServerProxy.__init__(self, address, transport=InwxTransport(), encoding = "UTF-8", verbose=verbose)
self.account.login({'lang': language, 'user': username, 'pass': password})
示例14: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__(self, uri, *args, **kw):
ServerProxy.__init__(self, uri = uri, *args, **kw)
self.__uri = uri
示例15: __init__
# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import __init__ [as 别名]
def __init__ (self, address, verbose=False):
self.__address = address
ServerProxy.__init__(self, address, transport=InwxTransport(), encoding = "UTF-8", verbose=verbose)