Exemple #1
0
 def __init__(self):
     if IS_PY3:
         super(ProxiedTransport, self).__init__()
     else:  
         Transport.__init__(self)
     self.realhost = None
     self.proxy = None
Exemple #2
0
    def __init__(self, secure=False, username=None, password=None):
        Transport.__init__(self)

        self.secure = secure

        self.username = username
        self.password = password
    def __init__(self, url, cookiejar=None,
                 sslverify=True, sslcafile=None, debug=0):
        if hasattr(Transport, "__init__"):
            Transport.__init__(self, use_datetime=False)

        self.verbose = debug
        self._cookiejar = cookiejar

        # transport constructor needs full url too, as xmlrpc does not pass
        # scheme to request
        self.scheme = urlparse(url)[0]
        if self.scheme not in ["http", "https"]:
            raise Exception("Invalid URL scheme: %s (%s)" % (self.scheme, url))

        self.use_https = self.scheme == 'https'

        self.request_defaults = {
            'cert': sslcafile if self.use_https else None,
            'cookies': cookiejar,
            'verify': sslverify,
            'headers': {
                'Content-Type': 'text/xml',
                'User-Agent': self.user_agent,
            }
        }

        # Using an explicit Session, rather than requests.get, will use
        # HTTP KeepAlive if the server supports it.
        self.session = requests.Session()
    def __init__(self, url, cookiejar=None,
                 sslverify=True, sslcafile=None, debug=True, cert=None):
        if hasattr(Transport, "__init__"):
            Transport.__init__(self, use_datetime=False)

        self.verbose = debug
        self._cookiejar = cookiejar

        # transport constructor needs full url too, as xmlrpc does not pass
        # scheme to request
        self.scheme = urlparse(url)[0]
        if self.scheme not in ["http", "https"]:
            raise Exception("Invalid URL scheme: %s (%s)" % (self.scheme, url))

        self.use_https = self.scheme == 'https'

        self.request_defaults = {
            'cert': sslcafile if self.use_https else None,
            'cookies': cookiejar,
            'verify': sslverify,
            'headers': {
                'Content-Type': 'text/xml',
                'User-Agent': self.user_agent,
            }
        }

        # Using an explicit Session, rather than requests.get, will use
        # HTTP KeepAlive if the server supports it.
        self.session = requests.Session()
        if cert:
            self.session.cert = cert
 def __init__(self):
     if IS_PY3:
         super(ProxiedTransport, self).__init__()
     else:
         Transport.__init__(self)
     self.realhost = None
     self.proxy = None
Exemple #6
0
 def __init__(self, config, path=None):
     """
     :param config: The jsonrpclib configuration
     :param path: Path to the Unix socket (overrides the host name later)
     """
     TransportMixIn.__init__(self, config)
     XMLTransport.__init__(self)
     # Keep track of the given path, if any
     self.__unix_path = os.path.abspath(path) if path else None
Exemple #7
0
 def __init__(self, config, path=None):
     """
     :param config: The jsonrpclib configuration
     :param path: Path to the Unix socket (overrides the host name later)
     """
     TransportMixIn.__init__(self, config)
     XMLTransport.__init__(self)
     # Keep track of the given path, if any
     self.__unix_path = os.path.abspath(path) if path else None
Exemple #8
0
    def __init__(self, bugzillasession):
        if hasattr(Transport, "__init__"):
            Transport.__init__(self, use_datetime=False)

        self.__bugzillasession = bugzillasession
        self.__bugzillasession.set_xmlrpc_defaults()
        self.__seen_valid_xml = False

        # Override Transport.user_agent
        self.user_agent = self.__bugzillasession.get_user_agent()
Exemple #9
0
    def __init__(self, use_datetime=0, pin='', key_name="01:01"):
        Transport.__init__(self, use_datetime=use_datetime)

        self.get_engine()
        cls = PKCS11Transport

        import getpass
        pin = getpass.getpass()

        self.cert = cls._pkcs11.load_certificate(key_name)
        self.key = cls._pkcs11.load_private_key(key_name, pin=pin)

        # Use False to prevent setting the crypto list which causes an NPE
        self.context = SSL.Context('tlsv1', False)

        # Manually load the key and cert into the context because the helper
        # doesn't read from the smart card or handle DER-encoded certs
        m2.ssl_ctx_use_pkey_privkey(self.context.ctx, self.key._ptr())
        m2.ssl_ctx_use_x509(self.context.ctx, self.cert._ptr())

        self.context.load_verify_locations("ca.pem", "")
        self.context.set_verify(SSL.verify_peer, 10)
        self.context.set_info_callback()
Exemple #10
0
 def __init__(self, scheme):
     Transport.__init__(self)
     self._scheme = scheme
     self.verbose = 0
     self._possible_bzr_transports = []
Exemple #11
0
 def __init__(self, config):
     TransportMixIn.__init__(self, config)
     XMLTransport.__init__(self)
 def __init__(self, timeout):
     Transport.__init__(self)
     self.timeout = timeout
Exemple #13
0
 def __init__(self, service, uri, use_datetime=1):
     self.service = service
     self.uri = uri
     Transport.__init__(self, use_datetime=use_datetime)
Exemple #14
0
 def __init__(self, ProxyServer):
     Transport.__init__(self)
     self.ProxyServer = ProxyServer
Exemple #15
0
 def __init__(self, scheme):
     Transport.__init__(self)
     self._scheme = scheme
     self._opener = _urllib2_wrappers.Opener()
     self.verbose = 0
Exemple #16
0
 def __init__(self):
     Transport.__init__(self)
     self._cookies = dict()
Exemple #17
0
 def __init__(self):
     TransportMixIn.__init__(self)
     XMLTransport.__init__(self)
Exemple #18
0
 def __init__(self):
     Transport.__init__(self)
     self._cookies = dict()
Exemple #19
0
 def __init__(self, *args, **kwargs):
     self.socket_path = kwargs.pop("socket_path", "")
     Transport.__init__(self, *args, **kwargs)
Exemple #20
0
 def __init__(self, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.client = Client()
Exemple #21
0
 def __init__(self, timeout: typing.Union[int, float]=socket._GLOBAL_DEFAULT_TIMEOUT, *args, **kwargs) -> None:
     Transport.__init__(self, *args, **kwargs)
     self._timeout = timeout
Exemple #22
0
 def __init__(self, config):
     TransportMixIn.__init__(self, config)
     XMLTransport.__init__(self)
Exemple #23
0
 def __init__(self, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self._timeout = timeout
Exemple #24
0
 def __init__(self, timeout):
     Transport.__init__(self)
     self.timeout = timeout
Exemple #25
0
 def __init__(self,
              timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
              *args,
              **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self._timeout = timeout
Exemple #26
0
 def __init__(self, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.client = Client()
Exemple #27
0
 def __init__(self, timeout=None, *args, **kwargs):
     Transport.__init__(self, *args, **kwargs)
     self.timeout = timeout