Exemplo n.º 1
0
    def __init__(self, username, password, verbose=0, use_datetime=False,
                 https_handler=None):
        Transport.__init__(self, use_datetime=False)
        self._username = username
        self._password = password
        self._use_datetime = use_datetime
        self.verbose = verbose
        self._username = username
        self._password = password

        self._handlers = []

        if self._username and self._password:
            self._passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
            self._auth_handler = urllib2.HTTPDigestAuthHandler(self._passmgr)
        else:
            self._auth_handler = None
            self._passmgr = None

        if https_handler:
            self._handlers.append(https_handler)
            self._scheme = 'https'
        else:
            self._scheme = 'http'

        if self._auth_handler:
            self._handlers.append(self._auth_handler)
Exemplo n.º 2
0
    def __init__(self, socket):
        Transport.__init__(self)

        def connect(self):
            self.sock = socket

        connection = httplib.HTTPConnection
        connection.connect = connect
Exemplo n.º 3
0
 def __init__(self, endpoint, cookie_jar=None):
     Transport.__init__(self, use_datetime=True)
     self.scheme, self.host = urlparse(endpoint)[:2]
     assert self.scheme in ('http', 'https'), (
         "Unsupported URL scheme: %s" % self.scheme)
     self.cookie_processor = HTTPCookieProcessor(cookie_jar)
     self.redirect_handler = XMLRPCRedirectHandler()
     self.opener = build_opener(
         self.cookie_processor, self.redirect_handler)
     self.timeout = config.checkwatches.default_socket_timeout
Exemplo n.º 4
0
    def __init__(self, ca_certs=None, keyfile=None, certfile=None, cert_reqs=None,
                 ssl_version=None, timeout=None, strict=None):

        self.ca_certs = ca_certs
        self.keyfile = keyfile
        self.certfile = certfile
        self.cert_reqs = cert_reqs
        self.ssl_version = ssl_version
        self.timeout = timeout
        self.strict = strict

        Transport.__init__(self)
Exemplo n.º 5
0
    def __init__(self, realm, url, username=None, password=None, **kwds):
        """
        Initialization.

        EXAMPLES::

            sage: from trac_interface import REALM, TRAC_SERVER_URI, DigestTransport
            sage: type(DigestTransport(REALM, TRAC_SERVER_URI+"/xmlrpc"))
            trac_interface.DigestTransport

        """
        Transport.__init__(self, **kwds)

        authhandler = urllib2.HTTPDigestAuthHandler()
        if username and password:
            authhandler.add_password(realm, url, username, password)

        self.opener = urllib2.build_opener(authhandler)
Exemplo n.º 6
0
    def __init__(self, key_file, cert_file):
        Transport.__init__(self)
        self.key_file = key_file
        self.cert_file = cert_file

        # in pyth version 2.7 upwards, the xmlrpclib.Transport library seems
        # to re-use connections or for some other reason likes to store the
        # connection in self._connection.  This version is designed to work
        # with both without clobbering either.  This is potentially brittle
        # code, so we check the python version so we can revise things if
        # neccessary

        if sys.version_info[0] == 2 and sys.version_info[1] not in (6,7):
            sys.stderr.write("SaferTransport implementation has not been " + \
                    "checked in this version.  Please check to make sure " + \
                    "it still works\n")

        self._connection = (None, None)
Exemplo n.º 7
0
	def __init__(self, uri, cookiejar=None, use_datetime=0):
		Transport.__init__(self, use_datetime=use_datetime)

		self.opener = build_opener()

		# Parse auth (user:passwd) from the uri
		urltype, rest = splittype(uri)
		host, rest = splithost(rest)
		auth, host = splituser(host)
		self.uri = urltype + '://' + host + rest

		# Handle HTTP Basic authentication
		if auth is not None:
			user, passwd = splitpasswd(auth)
			passwdmgr = HTTPPasswordMgrWithDefaultRealm()
			passwdmgr.add_password(realm=None, uri=self.uri, user=user, passwd=passwd)
			authhandler = HTTPBasicAuthHandler(passwdmgr)
			self.opener.add_handler(authhandler)

		# Handle HTTP Cookies
		if cookiejar is not None:
			self.opener.add_handler(HTTPCookieProcessor(cookiejar))
Exemplo n.º 8
0
 def __init__(self, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.client = Client()
Exemplo n.º 9
0
 def __init__(self, timeout, use_datetime=0):
     self.timeout = timeout
     # xmlrpclib uses old-style classes so we cannot use super()
     Transport.__init__(self, use_datetime)
Exemplo n.º 10
0
 def __init__(self, timeout, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.timeout = timeout
Exemplo n.º 11
0
    def __init__(self, realm, url, username, password, **kwds):
        Transport.__init__(self, **kwds)

        authhandler = urllib2.HTTPDigestAuthHandler()
        authhandler.add_password(realm, url, username, password)
        self.opener = urllib2.build_opener(authhandler)
Exemplo n.º 12
0
Arquivo: rpc.py Projeto: stlaz/freeipa
 def __init__(self, *args, **kwargs):
     Transport.__init__(self)
     self.protocol = kwargs.get('protocol', None)
Exemplo n.º 13
0
 def __init__(self, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self._timeout = timeout
Exemplo n.º 14
0
 def __init__(self, protocol):
     Transport.__init__(self)
     self.protocol = protocol
Exemplo n.º 15
0
 def __init__(self, ssl_context, *args, **kw):
     Transport.__init__(self, *args, **kw)
     self.ssl_ctx = ssl_context
     # Connection cache: (url, HTTPSConnection object)
     self._connection = (None, None)
Exemplo n.º 16
0
    def __init__(self, *l, **kw):
        self.timeout = kw.get('timeout', 10)
        if 'timeout' in kw.keys():
            del kw['timeout']

        Transport.__init__(self, *l, **kw)
Exemplo n.º 17
0
 def __init__(self, timeout=None, use_datetime=0):
     self.timeout = timeout
     Transport.__init__(self, use_datetime)
Exemplo n.º 18
0
 def __init__(self):
     Transport.__init__(self)
     self.cookie = None
Exemplo n.º 19
0
 def __init__(self, http_client):
     Transport.__init__(self)
     self.httpClient = http_client
     self.protocol = http_client.getProperty('protocol')
     self.recordLog = False
Exemplo n.º 20
0
    def __init__(self, *l, **kw):
        self.timeout = kw.get('timeout', 10)
        if 'timeout' in kw.keys():
            del kw['timeout']

        Transport.__init__(self, *l, **kw)
Exemplo n.º 21
0
 def __init__(self, request, use_datetime=0):
     Transport.__init__(self, use_datetime)
     self.orig_request = request
Exemplo n.º 22
0
 def __init__(self):
     Transport.__init__(self, use_datetime=0)
Exemplo n.º 23
0
 def __init__(self, timeout=None, use_datetime=0):
     self.timeout = timeout
     Transport.__init__(self, use_datetime)
Exemplo n.º 24
0
    def __init__(self, realm, url, username, password, **kwds):
        Transport.__init__(self, **kwds)

        authhandler = urllib2.HTTPDigestAuthHandler()
        authhandler.add_password(realm, url, username, password)
        self.opener = urllib2.build_opener(authhandler)
Exemplo n.º 25
0
 def __init__(self):
     TransportMixIn.__init__(self)
     XMLTransport.__init__(self)
Exemplo n.º 26
0
 def __init__(self):
     TransportMixIn.__init__(self)
     XMLTransport.__init__(self)
Exemplo n.º 27
0
 def __init__(self, use_datetime=0, send_gzip=False):
     Transport.__init__(self)
     self._use_datetime = use_datetime
     self._http = {}
     self._log = logging.getLogger('Rpc.Transport')
     self._send_gzip = send_gzip
Exemplo n.º 28
0
 def __init__(self, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.client = Client()
Exemplo n.º 29
0
 def __init__(self):
     Transport.__init__(self)
     self.cookie = None
Exemplo n.º 30
0
 def __init__(self, *args, **kwargs):
     Transport.__init__(self)
     self.protocol = kwargs.get('protocol', None)
Exemplo n.º 31
0
 def __init__(self, request, use_datetime=0):
     Transport.__init__(self, use_datetime)
     self.orig_request = request
Exemplo n.º 32
0
 def __init__(self, protocol):
     Transport.__init__(self)
     self.protocol = protocol
Exemplo n.º 33
0
 def __init__(self, timeout=DEFAULT_TIMEOUT, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.timeout=timeout