File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
- class IbmAuthHelper ():
1
+ import requests
2
+
3
+
4
+ class IbmAuthHelper :
2
5
'''Authenticate with IBM Cloud IAM.
3
6
4
7
**Arguments**
@@ -14,8 +17,8 @@ class IbmAuthHelper():
14
17
def get_headers (url , apikey , guid ):
15
18
iam_token = IbmAuthHelper .__get_iam_token (url , apikey )
16
19
return {
17
- 'Authorization' : 'Bearer ' + iam_token ,
18
- 'IBMInstanceID' : guid
20
+ 'Authorization' : 'Bearer ' + iam_token ,
21
+ 'IBMInstanceID' : guid
19
22
}
20
23
21
24
@staticmethod
@@ -32,7 +35,7 @@ def __get_iam_endpoint(url):
32
35
@staticmethod
33
36
def __get_iam_token (url , apikey ):
34
37
env_url = IbmAuthHelper .__get_iam_endpoint (url )
35
- response = self . http .post (
38
+ response = requests .post (
36
39
'https://' + env_url + '/identity/token' ,
37
40
data = {
38
41
'grant_type' : 'urn:ibm:params:oauth:grant-type:apikey' ,
You can’t perform that action at this time.
0 commit comments