|
| 1 | +diff --git a/kubernetes_asyncio/client/configuration.py b/kubernetes_asyncio/client/configuration.py |
| 2 | +index 720bb81f..b2522c23 100644 |
| 3 | +--- a/kubernetes_asyncio/client/configuration.py |
| 4 | ++++ b/kubernetes_asyncio/client/configuration.py |
| 5 | +@@ -12,6 +12,7 @@ |
| 6 | + |
| 7 | + from __future__ import absolute_import |
| 8 | + |
| 9 | ++import asyncio |
| 10 | + import copy |
| 11 | + import logging |
| 12 | + import sys |
| 13 | +@@ -370,7 +371,7 @@ conf = client.Configuration( |
| 14 | + self.__logger_format = value |
| 15 | + self.logger_formatter = logging.Formatter(self.__logger_format) |
| 16 | + |
| 17 | +- def get_api_key_with_prefix(self, identifier, alias=None): |
| 18 | ++ async def get_api_key_with_prefix(self, identifier, alias=None): |
| 19 | + """Gets API key (with prefix if set). |
| 20 | + |
| 21 | + :param identifier: The identifier of apiKey. |
| 22 | +@@ -378,7 +379,9 @@ conf = client.Configuration( |
| 23 | + :return: The token for api key authentication. |
| 24 | + """ |
| 25 | + if self.refresh_api_key_hook is not None: |
| 26 | +- self.refresh_api_key_hook(self) |
| 27 | ++ result = self.refresh_api_key_hook(self) |
| 28 | ++ if asyncio.iscoroutine(result): |
| 29 | ++ await result |
| 30 | + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) |
| 31 | + if key: |
| 32 | + prefix = self.api_key_prefix.get(identifier) |
| 33 | +@@ -402,7 +405,7 @@ conf = client.Configuration( |
| 34 | + basic_auth=username + ':' + password |
| 35 | + ).get('authorization') |
| 36 | + |
| 37 | +- def auth_settings(self): |
| 38 | ++ async def auth_settings(self): |
| 39 | + """Gets Auth Settings dict for api client. |
| 40 | + |
| 41 | + :return: The Auth Settings information dict. |
| 42 | +@@ -413,7 +416,7 @@ conf = client.Configuration( |
| 43 | + 'type': 'api_key', |
| 44 | + 'in': 'header', |
| 45 | + 'key': 'authorization', |
| 46 | +- 'value': self.get_api_key_with_prefix( |
| 47 | ++ 'value': await self.get_api_key_with_prefix( |
| 48 | + 'BearerToken', |
| 49 | + ), |
| 50 | + } |
0 commit comments