@@ -171,7 +171,7 @@ def ibmid_login(env):
171171 user = client .call ('SoftLayer_Account' , 'getCurrentUser' , mask = "mask[id,username,apiAuthenticationKeys]" )
172172
173173 if len (user .get ('apiAuthenticationKeys' , [])) == 0 :
174- env .fout ("Creating a Classic Infrastrucutre API key for {}" . format ( user ['username' ]) )
174+ env .fout (f "Creating a Classic Infrastrucutre API key for { user ['username' ]} " )
175175 api_key = client .call ('User_Customer' , 'addApiAuthenticationKey' , id = user ['id' ])
176176 else :
177177 api_key = user ['apiAuthenticationKeys' ][0 ]['authenticationKey' ]
@@ -188,7 +188,7 @@ def get_accounts(env, a_token):
188188 'User-Agent' : USER_AGENT ,
189189 'Accept' : 'application/json'
190190 }
191- headers ['Authorization' ] = 'Bearer {}' . format ( a_token )
191+ headers ['Authorization' ] = f 'Bearer { a_token } '
192192 response = iam_client .request (
193193 'GET' ,
194194 'https://accounts.cloud.ibm.com/v1/accounts' ,
@@ -212,7 +212,7 @@ def get_accounts(env, a_token):
212212 ims_id = link .get ('id' )
213213 if ims_id is None :
214214 ims_id = "Unlinked"
215- env .fout ("{ }: {} ({})" . format ( counter , utils .lookup (selected , 'entity' , 'name' ), ims_id ) )
215+ env .fout (f" { counter } : { utils .lookup (selected , 'entity' , 'name' )} ( { ims_id } )" )
216216 counter = counter + 1
217217 ims_id = None # Reset ims_id to avoid any mix-match or something.
218218 choice = click .prompt ('Enter a number' , type = int )
@@ -225,7 +225,7 @@ def get_accounts(env, a_token):
225225 if link .get ('origin' ) == "IMS" :
226226 ims_id = link .get ('id' )
227227
228- print ("Using account {}" . format ( utils .lookup (selected , 'entity' , 'name' )) )
228+ print (f "Using account { utils .lookup (selected , 'entity' , 'name' )} " )
229229 return {"account_id" : account_id , "ims_id" : ims_id }
230230
231231
@@ -253,7 +253,7 @@ def get_sso_url():
253253def sso_login (env ):
254254 """Uses a SSO token to get a SL apikey"""
255255 passcode_url = get_sso_url ()
256- env .fout ("Get a one-time code from {} to proceed." . format ( passcode_url ) )
256+ env .fout (f "Get a one-time code from { passcode_url } to proceed." )
257257 open_browser = env .input ("Open the URL in the default browser? [Y/n]" , default = 'Y' )
258258 if open_browser .lower () == 'y' :
259259 webbrowser .open (passcode_url )
@@ -274,7 +274,7 @@ def sso_login(env):
274274 user = client .call ('SoftLayer_Account' , 'getCurrentUser' , mask = "mask[id,username,apiAuthenticationKeys]" )
275275
276276 if len (user .get ('apiAuthenticationKeys' , [])) == 0 :
277- env .fout ("Creating a Classic Infrastrucutre API key for {}" . format ( user ['username' ]) )
277+ env .fout (f "Creating a Classic Infrastrucutre API key for { user ['username' ]} " )
278278 api_key = client .call ('User_Customer' , 'addApiAuthenticationKey' , id = user ['id' ])
279279 else :
280280 api_key = user ['apiAuthenticationKeys' ][0 ]['authenticationKey' ]
0 commit comments