pinecone.openapi_support.auth_util

 1from .exceptions import PineconeApiValueError
 2
 3
 4class AuthUtil:
 5    @staticmethod
 6    def update_params_for_auth(configuration, endpoint_auth_settings, headers, querys):
 7        """Updates header and query params based on authentication setting.
 8
 9        :param headers: Header parameters dict to be updated.
10        :param querys: Query parameters tuple list to be updated.
11        :param auth_settings: Authentication setting identifiers list.
12        """
13        if not endpoint_auth_settings:
14            return
15
16        for auth in endpoint_auth_settings:
17            auth_setting = configuration.auth_settings().get(auth)
18            if auth_setting:
19                if auth_setting["in"] == "header":
20                    if auth_setting["type"] != "http-signature":
21                        headers[auth_setting["key"]] = auth_setting["value"]
22                elif auth_setting["in"] == "query":
23                    querys.append((auth_setting["key"], auth_setting["value"]))
24                else:
25                    raise PineconeApiValueError(
26                        "Authentication token must be in `query` or `header`"
27                    )
class AuthUtil:
 5class AuthUtil:
 6    @staticmethod
 7    def update_params_for_auth(configuration, endpoint_auth_settings, headers, querys):
 8        """Updates header and query params based on authentication setting.
 9
10        :param headers: Header parameters dict to be updated.
11        :param querys: Query parameters tuple list to be updated.
12        :param auth_settings: Authentication setting identifiers list.
13        """
14        if not endpoint_auth_settings:
15            return
16
17        for auth in endpoint_auth_settings:
18            auth_setting = configuration.auth_settings().get(auth)
19            if auth_setting:
20                if auth_setting["in"] == "header":
21                    if auth_setting["type"] != "http-signature":
22                        headers[auth_setting["key"]] = auth_setting["value"]
23                elif auth_setting["in"] == "query":
24                    querys.append((auth_setting["key"], auth_setting["value"]))
25                else:
26                    raise PineconeApiValueError(
27                        "Authentication token must be in `query` or `header`"
28                    )
@staticmethod
def update_params_for_auth(configuration, endpoint_auth_settings, headers, querys):
 6    @staticmethod
 7    def update_params_for_auth(configuration, endpoint_auth_settings, headers, querys):
 8        """Updates header and query params based on authentication setting.
 9
10        :param headers: Header parameters dict to be updated.
11        :param querys: Query parameters tuple list to be updated.
12        :param auth_settings: Authentication setting identifiers list.
13        """
14        if not endpoint_auth_settings:
15            return
16
17        for auth in endpoint_auth_settings:
18            auth_setting = configuration.auth_settings().get(auth)
19            if auth_setting:
20                if auth_setting["in"] == "header":
21                    if auth_setting["type"] != "http-signature":
22                        headers[auth_setting["key"]] = auth_setting["value"]
23                elif auth_setting["in"] == "query":
24                    querys.append((auth_setting["key"], auth_setting["value"]))
25                else:
26                    raise PineconeApiValueError(
27                        "Authentication token must be in `query` or `header`"
28                    )

Updates header and query params based on authentication setting.

Parameters
  • headers: Header parameters dict to be updated.
  • querys: Query parameters tuple list to be updated.
  • auth_settings: Authentication setting identifiers list.