3
3
import requests as requests_http
4
4
from .general import General
5
5
from .sdkconfiguration import SDKConfiguration
6
- from typing import Dict
6
+ from typing import Callable , Dict , Union
7
7
from unstructured_client import utils
8
8
from unstructured_client .models import shared
9
9
@@ -14,7 +14,7 @@ class UnstructuredClient:
14
14
sdk_configuration : SDKConfiguration
15
15
16
16
def __init__ (self ,
17
- api_key_auth : str ,
17
+ api_key_auth : Union [ str , Callable [[], str ]] ,
18
18
server : str = None ,
19
19
server_url : str = None ,
20
20
url_params : Dict [str , str ] = None ,
@@ -24,7 +24,7 @@ def __init__(self,
24
24
"""Instantiates the SDK configuring it with the provided parameters.
25
25
26
26
:param api_key_auth: The api_key_auth required for authentication
27
- :type api_key_auth: Union[str,Callable[[], str]]
27
+ :type api_key_auth: Union[str, Callable[[], str]]
28
28
:param server: The server by name to use for all operations
29
29
:type server: str
30
30
:param server_url: The server URL to use for all operations
@@ -39,7 +39,11 @@ def __init__(self,
39
39
if client is None :
40
40
client = requests_http .Session ()
41
41
42
- security = shared .Security (api_key_auth = api_key_auth )
42
+ if callable (api_key_auth ):
43
+ def security ():
44
+ return shared .Security (api_key_auth = api_key_auth ())
45
+ else :
46
+ security = shared .Security (api_key_auth = api_key_auth )
43
47
44
48
if server_url is not None :
45
49
if url_params is not None :
0 commit comments