Skip to content

Commit

Permalink
fix for public ctype.
Browse files Browse the repository at this point in the history
  • Loading branch information
nik-io committed Jul 13, 2018
1 parent cd63174 commit 1fcbb9f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions python/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,15 @@ def login(self):
data = urllib.parse.urlencode({'grant_type': 'urn:ibm:params:oauth:grant-type:apikey', 'apikey': self.apikey})
else:
data = urllib.urlencode({'grant_type': 'urn:ibm:params:oauth:grant-type:apikey', 'apikey': self.apikey})
if self.instance_crn.split(':')[2] == 'staging':
url = 'https://iam.stage1.bluemix.net/identity/token'
else:
crn = self.instance_crn.replace('%3A', ':')
try:
if crn.split(':')[2] == 'staging':
url = 'https://iam.stage1.bluemix.net/identity/token'
else:
url = 'https://iam.bluemix.net/identity/token'
except Exception:
logging.warning('crn seems to be wrong')
# defautl to public url
url = 'https://iam.bluemix.net/identity/token'

headers = {
Expand Down

0 comments on commit 1fcbb9f

Please sign in to comment.