コード例 #1
0
def init40(config_file: str = "looker.ini",
           section: Optional[str] = None) -> methods40.Looker40SDK:
    """Default dependency configuration"""
    settings = _settings(config_file, section)
    settings.is_configured()
    transport = requests_transport.RequestsTransport.configure(settings)
    return methods40.Looker40SDK(
        auth_session.AuthSession(settings, transport, serialize.deserialize40,
                                 "4.0"),
        serialize.deserialize40,
        serialize.serialize,
        transport,
        "4.0",
    )
コード例 #2
0
    def get_looker_sdk(self):
        """Returns Looker SDK client for Looker API 4.0."""
        conn = self.get_connection(self.looker_conn_id)
        settings = LookerApiSettings(conn)

        transport = requests_transport.RequestsTransport.configure(settings)
        return methods40.Looker40SDK(
            auth_session.AuthSession(settings, transport,
                                     serialize.deserialize40, "4.0"),
            serialize.deserialize40,
            serialize.serialize,
            transport,
            "4.0",
        )
コード例 #3
0
ファイル: __init__.py プロジェクト: zgaocca/sdk-codegen
def init40(
    config_file: str = "looker.ini", section: Optional[str] = None
) -> methods40.Looker40SDK:
    """Default dependency configuration
    """
    settings = api_settings.ApiSettings(config_file, section)
    if not settings.is_configured():
        raise InitError("Missing required configuration values.")
    transport = requests_transport.RequestsTransport.configure(settings)
    return methods40.Looker40SDK(
        auth_session.AuthSession(settings, transport, serialize.deserialize40, "4.0"),
        serialize.deserialize40,
        serialize.serialize,
        transport,
        "4.0",
    )
コード例 #4
0
def configure_sdk():

    try:
        settings = api_settings.ApiSettings()
        user_agent_tag = f"Themis v1.0"
        settings.headers = {
            "Content-Type": "application/json",
            "User-Agent": user_agent_tag,
        }
        settings.timeout = 480
        transport = requests_transport.RequestsTransport.configure(settings)
    except Exception as e:
        logger.error('Issues generating SDK configuration: {}'.format(e))

    return methods.Looker40SDK(
        auth_session.AuthSession(settings, transport, serialize.deserialize40,
                                 "4.0"), serialize.deserialize40,
        serialize.serialize, transport, "4.0")
コード例 #5
0
ファイル: __init__.py プロジェクト: gene-blink/sdk-codegen
def init40(config_file: str = "looker.ini",
           section: Optional[str] = None) -> methods40.Looker40SDK:
    """Default dependency configuration
    """
    settings = api_settings.ApiSettings.configure(config_file, section)
    if settings.api_version is not None:
        warnings.warn(
            message=DeprecationWarning(API_SETTINGS_API_VERSION_DEPRECATED))
    settings.api_version = "4.0"
    settings.headers = {"Content-Type": "application/json"}
    if not settings.is_configured():
        raise InitError(
            f"Missing required configuration values like base_url and api_version."
        )
    transport = requests_transport.RequestsTransport.configure(settings)
    return methods40.Looker40SDK(
        auth_session.AuthSession(settings, transport, serialize.deserialize40),
        serialize.deserialize40,
        serialize.serialize,
        transport,
    )