Exemplo n.º 1
0
    def __init__(self, wsdl_url, username, password, servicename=None):
        #create parser and download the WSDL document
        self.url = wsdl_url
        self.username = username
        self.password = password
        self.servicename = servicename
        if servicename:
            self.url = self.get_service_url()
        if is_https(self.url):
            logger.info("Creating secure connection")
            from suds.transport.http import HttpAuthenticated
            http_transport = HttpAuthenticated(username=self.username,
                                               password=self.password)
        else:
            from suds.transport.http import HttpAuthenticated
            http_transport = HttpAuthenticated(username=self.username,
                                               password=self.password)

        #Client.__init__(self, self.url, transport=http_transport, plugins=[SoapFixer()]) # uncomment after testing
        #schema_import = Import(schema_url)
        #schema_doctor = ImportDoctor(schema_import)

        Client.__init__(self,
                        self.url,
                        transport=http_transport,
                        plugins=[SoapFixer()])  # added for testing purpose
Exemplo n.º 2
0
    def __init__(self, url, cert, verify=True, **kwargs):
        """
        Initialisation.

        Sets up the underlying client with a certificate authenticated
        http transport. This can be overridden if the user provides an
        alternative transport in keyword args.

        Args:
            url (str): The url to connect to.
            cert (tuple): Tuple containing the path to the cert file followed
                          by the path to the key file as strings.
            verify (bool/str): Whether to verify the url. If a string is given
                               then this is used as the path to a CA_BUNDLE file
                               or directory with certificates of trusted CAs.
                               Note: If verify is set to a path to a directory,
                               the directory must have been processed using the
                               c_rehash utility supplied with OpenSSL. This list
                               of trusted CAs can also be specified through the
                               REQUESTS_CA_BUNDLE environment variable (this may
                               cause pip to fail to validate against PyPI).
        """
        kwargs.setdefault('transport', HttpCertAuthenticated(cert, verify))
        Client.__init__(self, url, **kwargs)
        # Shouldn't be necessary but Client is ignoring the headers kwarg
        headers = kwargs.get('headers', None)
        self.set_options(headers=headers)
Exemplo n.º 3
0
 def __init__(self, WSDL_URI=BIOMODELS_WSDL_URI):
     """Initialize the client with the available queries listed in
     the WSDL file. All the queries can be executed using the following syntax:
     
     client.service.queryToBeExecuted()
     """
     try:
         Client.__init__(self, WSDL_URI, proxy=proxyOpts)
     except Exception as e:
         print(e)
    def __init__(self, WSDL_URI=BIOMODELS_WSDL_URI):
	"""Initialize the client with the available queries listed in
	the WSDL file. All the queries can be executed using the following syntax:
	
	client.service.queryToBeExecuted()
	"""
	try:
	    Client.__init__(self, WSDL_URI)
	except Exception, e:
	    print e
Exemplo n.º 5
0
 def __init__(self, WSDL_URI=BIOMODELS_WSDL_URI):
     """Initialize the client with the available queries listed in
     the WSDL file. All the queries can be executed using the following syntax:
     
     client.service.queryToBeExecuted()
     """
     try:
         Client.__init__(self, WSDL_URI,proxy=proxyOpts)
         #Client.__init__(self, WSDL_URI,transport=HttpTransport())
     except Exception as e:
         print(e)
Exemplo n.º 6
0
 def __init__(self,
              url,
              slug=None,
              related_objects=None,
              session=None,
              transport=None,
              timeout=None,
              **kwargs):
     transport = transport or SecurityRequestsTransport(
         slug=slug,
         related_objects=related_objects,
         session=session,
         timeout=timeout)
     DefaultClient.__init__(self, url, transport=transport, **kwargs)
Exemplo n.º 7
0
 def __init__(self, table, instance):
     self.__table = table
     self.__instance = instance
     username = Config.getUsername(instance)
     password = Config.getPassword(instance)
     SLogger.debug("Connecting to %s to download from table %s" % (instance, table))
     try:
         Client.__init__(self,
                         instance + table + "_list.do?WSDL",
                         username=username,
                         password=password,
                         timeout=Config.getTimeout())
     except URLError, e:
         SnowClient.__processURLError(e)
 def __init__(self, wsdl_url, username, password, servicename = None):
     #create parser and download the WSDL document
     self.url = wsdl_url
     self.username = username
     self.password = password
     self.servicename = servicename
     if servicename:
         self.url = self.get_service_url()     
     if is_https(self.url):
         logger.info("Creating secure connection")
         from suds.transport.http import HttpAuthenticated
         http_transport = HttpAuthenticated(username=self.username, password=self.password)
     else:
         from suds.transport.http import HttpAuthenticated
         http_transport = HttpAuthenticated(username=self.username, password=self.password)
     
     #Client.__init__(self, self.url, transport=http_transport, plugins=[SoapFixer()]) # uncomment after testing
     #schema_import = Import(schema_url)
     #schema_doctor = ImportDoctor(schema_import)
 
     Client.__init__(self, self.url, transport=http_transport, plugins=[SoapFixer()]) # added for testing purpose
Exemplo n.º 9
0
    def __init__(self,options,config_file=None,session="DWE"):
        """Datastream SOAP Client

        >>> ds=Datastream()
        """

        _set_debug(logging.WARN,
                   'suds.resolver',
                   'suds.metrics',
                   'suds.xsd.sxbasic',
                   'suds.xsd.query',
                   'suds.client',
                   'suds.wsdl',
                   'suds.transport.http',
                   'suds.mx.core',
                   'suds.umx.typed',
                   'suds.xsd.schema',
                   'suds.xsd.sxbase',
                   'suds.mx.literal')

        if config_file is None:
            if exists(expanduser('~/.dwe.conf')):
                config_file = expanduser('~/.dwe.conf')
                os.chmod(config_file,stat.S_IRUSR | stat.S_IWUSR)
            else:
                config_file = DEFAULT_DSTREAM_CONF_FILE

        config_file = expanduser(expandvars(config_file))

        self._options = options

        if not exists(config_file):
            LOGGER.info('no configuration for datastream (%s). using BITS path',config_file)
            config_file = join(BITS_ETC,DEFAULT_BITS_CONF_FILE)

        self.config_file = config_file

        if not exists(self.config_file):
            raise IOError, 'Datastream Configuration File not Found %s' % config_file

        
        dstream_info = get_session(config_file,session,
                                   secure=True,
                                   url='http://dataworks.thomson.com/dataworks/enterprise/1.0/webServiceClient.asmx?WSDL',
                                   user=(None,ValueError),
                                   password=(None,ValueError),
                                   realm=''
                                   )
        self._auth=dstream_info

        t = HttpTransport()


        ### Proxy if any
        #
        proxy_info = get_proxy()        
        if proxy_info:
            pip={
                'http':proxy_info['proxy'],
                'https':proxy_info['proxy'],
                }
            proxy = urllib2.ProxyHandler(pip)
            # opener = urllib2.build_opener(SocksiPyHandler(socks.PROXY_TYPE_SOCKS4, 'localhost', 8080))
            opener = urllib2.build_opener(proxy)
            urllib2.install_opener(opener)
            t.urlopener = opener
            LOGGER.debug('proxy info for http: %s',pip['http'])
        #
        #
        ###
        try:
            Client.__init__(self,self._auth['url'],transport=t)
        except urllib2.URLError, exc:
            LOGGER.error('{}: No connection to {}'.format(self._options.job,self._auth['url']))
            raise exc
Exemplo n.º 10
0
 def __init__(self, url, slug=None, related_objects=None, session=None, transport=None, timeout=None, **kwargs):
     transport = transport or SecurityRequestsTransport(slug=slug, related_objects=related_objects, session=session,
                                                        timeout=timeout)
     DefaultClient.__init__(self, url, transport=transport, **kwargs)
 def __init__(self,*args,**kwargs):
     self.is_local = False
     self.subdomains = []
     # super(Client,self).__init__(*args,**kwargs)
     Client.__init__(self,*args,**kwargs)