Esempio n. 1
0
    def __init__(self, **kwds):
        """
        Initialization.

        EXAMPLES::

            sage: type(sage.dev.trac_interface.DigestTransport())
            <class 'sage.dev.trac_interface.DigestTransport'>
            sage: type(sage.dev.trac_interface.DigestTransport(realm='realm',
            ....:         url='url', username='******', password='******'))
            <class 'sage.dev.trac_interface.DigestTransport'>
        """
        def get_pop(this, k, d=None):
            try:
                return this.pop(k)
            except KeyError:
                return d

        auth = tuple(get_pop(kwds, x) for x in
                ('realm', 'url', 'username', 'password'))

        SafeTransport.__init__(self, **kwds)

        authhandler = urllib2.HTTPDigestAuthHandler()
        if all(x is not None for x in auth):
            authhandler.add_password(*auth)

        self.opener = urllib2.build_opener(authhandler)
Esempio n. 2
0
 def __init__(self, timeout=None, scheme='http'):
   SafeTransport.__init__(self)
   transport_class = Transport if scheme == 'http' else SafeTransport
   def make_connection(*args, **kw):
     connection = transport_class.make_connection(self, *args, **kw)
     if timeout is not None:
       connection.timeout = timeout
     return connection
   self.make_connection = make_connection
Esempio n. 3
0
 def __init__(self, timeout=None, scheme='http'):
   SafeTransport.__init__(self)
   transport_class = Transport if scheme == 'http' else SafeTransport
   def make_connection(*args, **kw):
     connection = transport_class.make_connection(self, *args, **kw)
     if timeout is not None:
       # BBB: On Python < 2.7, HTTP connection is wrapped
       getattr(connection, '_conn', connection).timeout = timeout
     return connection
   self.make_connection = make_connection
Esempio n. 4
0
    def __init__(self):
        """
        Initialization.

        EXAMPLES::

            sage: from sage.dev.digest_transport import DigestTransport
            sage: type(DigestTransport())
            <class 'sage.dev.digest_transport.DigestTransport'>
        """
        SafeTransport.__init__(self)
        self._opener = None
Esempio n. 5
0
    def __init__(self):
        """
        Initialization.

        EXAMPLES::

            sage: from sage.dev.digest_transport import DigestTransport
            sage: type(DigestTransport())
            <class 'sage.dev.digest_transport.DigestTransport'>
        """
        SafeTransport.__init__(self)
        self._opener = None
Esempio n. 6
0
    def __init__(self, timeout=None, scheme='http'):
        SafeTransport.__init__(self)
        transport_class = Transport if scheme == 'http' else SafeTransport

        def make_connection(*args, **kw):
            connection = transport_class.make_connection(self, *args, **kw)
            if timeout is not None:
                # BBB: On Python < 2.7, HTTP connection is wrapped
                getattr(connection, '_conn', connection).timeout = timeout
            return connection

        self.make_connection = make_connection
Esempio n. 7
0
    def __init__(self, timeout, url, *args, **kwargs):
        SafeTransport.__init__(self, *args, **kwargs)
        self.timeout = timeout
        self.host = None
        self.proxy = None
        self.scheme = url.split('://', 1)[0]
        self.https = url.startswith('https')
        self.proxy = os.environ.get('SZ_HTTP_PROXY')

        if self.https:
            self.context = default_ssl_context

        if self.proxy:
            logger.debug("Using proxy %s for: %s", self.proxy, url)
            self.https = self.proxy.startswith('https')

            if self.timeout:
                self.timeout = self.timeout * 3
Esempio n. 8
0
 def __init__(self, timeout=None):
     # Old style class call to super required.
     SafeTransport.__init__(self)
     self.timeout = timeout
Esempio n. 9
0
 def __init__(self, timeout, *args, **kwargs):
     SafeTransport.__init__(self, *args, **kwargs)
     self.timeout = timeout
     self.context = default_ssl_context
Esempio n. 10
0
 def __init__(self):
     TransportMixIn.__init__(self)
     XMLSafeTransport.__init__(self)
Esempio n. 11
0
 def __init__(self, timeout=None):
     # Old style class call to super required.
     SafeTransport.__init__(self)
     self.timeout = timeout
 def __init__(self, context=None):
     TransportMixIn.__init__(self)
     XMLSafeTransport.__init__(self, context)
Esempio n. 13
0
 def __init__(self, timeout=None, scheme="http"):
     self._timeout = timeout
     self._scheme = scheme
     SafeTransport.__init__(self)