コード例 #1
0
ファイル: qubole.py プロジェクト: shekharsaurabh/qds-sdk-py
    def agent(cls, version=None):
        """
        Returns:
           a connection object to make REST calls to QDS
           optionally override the `version` of the REST endpoint for advanced
           features available only in the newer version of the API available
           for certain resource end points eg: /v1.3/cluster. When version is
           None we default to v1.2
        """
        reuse_cached_agent = True
        if version:
            log.debug("api version changed to %s" % version)
            cls.rest_url = '/'.join([cls.baseurl.rstrip('/'), version])
            reuse_cached_agent = False
        else:
            cls.rest_url = '/'.join([cls.baseurl.rstrip('/'), cls.version])
        if cls.api_token is None:
            raise ConfigError(
                "No API Token specified - please supply one via Qubole.configure()"
            )

        if not reuse_cached_agent:
            uncached_agent = Connection(cls._auth, cls.rest_url,
                                        cls.skip_ssl_cert_check, True,
                                        cls.max_retries, cls.base_retry_delay)
            return uncached_agent
        if cls.cached_agent is None:
            cls.cached_agent = Connection(cls._auth, cls.rest_url,
                                          cls.skip_ssl_cert_check, True,
                                          cls.max_retries,
                                          cls.base_retry_delay)

        return cls.cached_agent
コード例 #2
0
ファイル: qubole.py プロジェクト: prakharjain09/qds-sdk-py
    def agent(cls):
        """
        Returns:
           a connection object to make REST calls to QDS
        """
        if cls.api_token is None:
            raise ConfigError("No API Token specified - please supply one via Qubole.configure()")

        if cls.cached_agent is None:
            cls.cached_agent = Connection(cls._auth, cls.base_url, cls.skip_ssl_cert_check)

        return cls.cached_agent