12
12
from .webhooks import Webhooks
13
13
from sdk import utils
14
14
from sdk .models import errors , operations , shared
15
- from typing import Dict , Optional
15
+ from typing import Callable , Dict , Optional , Union
16
16
17
17
class SDK :
18
18
r"""Formance Stack API: Open, modular foundation for unique payments flows
@@ -39,7 +39,7 @@ class SDK:
39
39
sdk_configuration : SDKConfiguration
40
40
41
41
def __init__ (self ,
42
- authorization : str ,
42
+ authorization : Union [ str , Callable [[], str ]] ,
43
43
server_idx : int = None ,
44
44
server_url : str = None ,
45
45
url_params : Dict [str , str ] = None ,
@@ -49,7 +49,7 @@ def __init__(self,
49
49
"""Instantiates the SDK configuring it with the provided parameters.
50
50
51
51
:param authorization: The authorization required for authentication
52
- :type authorization: Union[str,Callable[[], str]]
52
+ :type authorization: Union[str, Callable[[], str]]
53
53
:param server_idx: The index of the server to use for all operations
54
54
:type server_idx: int
55
55
:param server_url: The server URL to use for all operations
@@ -64,7 +64,11 @@ def __init__(self,
64
64
if client is None :
65
65
client = requests_http .Session ()
66
66
67
- security = shared .Security (authorization = authorization )
67
+ if callable (authorization ):
68
+ def security ():
69
+ return shared .Security (authorization = authorization ())
70
+ else :
71
+ security = shared .Security (authorization = authorization )
68
72
69
73
if server_url is not None :
70
74
if url_params is not None :
0 commit comments