File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -79,11 +79,11 @@ def __init__(self,
79
79
proxies : Optional [Dict [str , str ]] = None ,
80
80
scope : Optional [str ] = None ) -> None :
81
81
self .apikey = apikey
82
+ if not url :
83
+ url = self .DEFAULT_IAM_URL
84
+ if url .endswith (self .OPERATION_PATH ):
85
+ url = url [:- len (self .OPERATION_PATH )]
82
86
self .url = url
83
- if url == "" :
84
- self .url = self .DEFAULT_IAM_URL
85
- elif url .endswith (self .OPERATION_PATH ):
86
- self .url = url [:- len (self .OPERATION_PATH )]
87
87
self .client_id = client_id
88
88
self .client_secret = client_secret
89
89
self .headers = headers
@@ -125,7 +125,7 @@ def request_token(self) -> dict:
125
125
126
126
response = self ._request (
127
127
method = 'POST' ,
128
- url = self .url + self .OPERATION_PATH ,
128
+ url = ( self .url + self .OPERATION_PATH ) if self . url else self . url ,
129
129
headers = headers ,
130
130
data = data ,
131
131
auth_tuple = auth_tuple ,
Original file line number Diff line number Diff line change 11
11
def test_iam_authenticator ():
12
12
authenticator = IAMAuthenticator (apikey = 'my_apikey' )
13
13
assert authenticator is not None
14
- assert authenticator .token_manager .url == 'https://iam.cloud.ibm.com/identity/token '
14
+ assert authenticator .token_manager .url == 'https://iam.cloud.ibm.com'
15
15
assert authenticator .token_manager .client_id is None
16
16
assert authenticator .token_manager .client_secret is None
17
17
assert authenticator .token_manager .disable_ssl_verification is False
You can’t perform that action at this time.
0 commit comments