Esempio 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)
Esempio n. 2
0
    def __init__(self, socket):
        Transport.__init__(self)

        def connect(self):
            self.sock = socket

        connection = httplib.HTTPConnection
        connection.connect = connect
Esempio 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
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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))
Esempio n. 8
0
 def __init__(self, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.client = Client()
Esempio 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)
Esempio n. 10
0
 def __init__(self, timeout, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.timeout = timeout
Esempio 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)
Esempio n. 12
0
File: rpc.py Progetto: stlaz/freeipa
 def __init__(self, *args, **kwargs):
     Transport.__init__(self)
     self.protocol = kwargs.get('protocol', None)
Esempio n. 13
0
 def __init__(self, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self._timeout = timeout
Esempio n. 14
0
 def __init__(self, protocol):
     Transport.__init__(self)
     self.protocol = protocol
Esempio 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)
    def __init__(self, *l, **kw):
        self.timeout = kw.get('timeout', 10)
        if 'timeout' in kw.keys():
            del kw['timeout']

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

        Transport.__init__(self, *l, **kw)
Esempio n. 21
0
 def __init__(self, request, use_datetime=0):
     Transport.__init__(self, use_datetime)
     self.orig_request = request
Esempio n. 22
0
 def __init__(self):
     Transport.__init__(self, use_datetime=0)
Esempio n. 23
0
 def __init__(self, timeout=None, use_datetime=0):
     self.timeout = timeout
     Transport.__init__(self, use_datetime)
Esempio 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)
Esempio n. 25
0
 def __init__(self):
     TransportMixIn.__init__(self)
     XMLTransport.__init__(self)
Esempio n. 26
0
 def __init__(self):
     TransportMixIn.__init__(self)
     XMLTransport.__init__(self)
Esempio 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
Esempio n. 28
0
 def __init__(self, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.client = Client()
Esempio n. 29
0
 def __init__(self):
     Transport.__init__(self)
     self.cookie = None
Esempio n. 30
0
 def __init__(self, *args, **kwargs):
     Transport.__init__(self)
     self.protocol = kwargs.get('protocol', None)
Esempio n. 31
0
 def __init__(self, request, use_datetime=0):
     Transport.__init__(self, use_datetime)
     self.orig_request = request
Esempio n. 32
0
 def __init__(self, protocol):
     Transport.__init__(self)
     self.protocol = protocol
Esempio n. 33
0
 def __init__(self, timeout=DEFAULT_TIMEOUT, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.timeout=timeout