elastic_enterprise_search/_async/client/__init__.py [80:112]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def oauth_authorize_url(
        self, *, response_type: str, client_id: str, redirect_uri: str
    ) -> str:
        """Constructs an OAuth authorize URL to start either the Confidential flow
        (response_type='code') or Implicit flow (response_type='token')

        :param response_type: Either 'code' for the confidential flow or 'token'
            for the implicit flow.
        :param client_id: Client ID as generated when setting up an OAuth application
        :param redirect_uri: Location to redirect user once the OAuth process is completed.
            Must match one of the URIs configured in the OAuth application
        :returns: URL to redirect the user to visit in a browser
        """
        if response_type not in ("token", "code"):
            raise ValueError(
                "'response_type' must be either 'code' for confidential flow"
                "or 'token' for implicit flow"
            )
        if not all(
            isinstance(param, str) for param in (response_type, client_id, redirect_uri)
        ):
            raise TypeError("All parameters must be of type 'str'")

        # Get a random node from the pool to use as a base URL.
        base_url = self.transport.node_pool.get().base_url.rstrip("/")
        query = urlencode(
            [
                ("response_type", response_type),
                ("client_id", client_id),
                ("redirect_uri", redirect_uri),
            ]
        )
        return f"{base_url}/ws/oauth/authorize?{query}"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



elastic_enterprise_search/_sync/client/__init__.py [80:112]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    def oauth_authorize_url(
        self, *, response_type: str, client_id: str, redirect_uri: str
    ) -> str:
        """Constructs an OAuth authorize URL to start either the Confidential flow
        (response_type='code') or Implicit flow (response_type='token')

        :param response_type: Either 'code' for the confidential flow or 'token'
            for the implicit flow.
        :param client_id: Client ID as generated when setting up an OAuth application
        :param redirect_uri: Location to redirect user once the OAuth process is completed.
            Must match one of the URIs configured in the OAuth application
        :returns: URL to redirect the user to visit in a browser
        """
        if response_type not in ("token", "code"):
            raise ValueError(
                "'response_type' must be either 'code' for confidential flow"
                "or 'token' for implicit flow"
            )
        if not all(
            isinstance(param, str) for param in (response_type, client_id, redirect_uri)
        ):
            raise TypeError("All parameters must be of type 'str'")

        # Get a random node from the pool to use as a base URL.
        base_url = self.transport.node_pool.get().base_url.rstrip("/")
        query = urlencode(
            [
                ("response_type", response_type),
                ("client_id", client_id),
                ("redirect_uri", redirect_uri),
            ]
        )
        return f"{base_url}/ws/oauth/authorize?{query}"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



