Entrust: add organization handling-linting
This commit is contained in:
parent
949a123cb9
commit
8738c4d893
|
@ -83,6 +83,7 @@ def process_options(options, client_id):
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def get_client_id(my_response, organization):
|
def get_client_id(my_response, organization):
|
||||||
"""
|
"""
|
||||||
Helper function for parsing responses from the Entrust API.
|
Helper function for parsing responses from the Entrust API.
|
||||||
|
@ -94,19 +95,16 @@ def get_client_id(my_response, organization):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# catch an empty json object here
|
# catch an empty json object here
|
||||||
d = {'response': 'No detailed message'}
|
d = {'response': 'No detailed message'}
|
||||||
s = my_response.status_code
|
|
||||||
if s > 399:
|
|
||||||
raise Exception(f"ENTRUST error: {msg.get(s, s)}\n{d['errors']}")
|
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
for y in d["organizations"]:
|
for y in d["organizations"]:
|
||||||
if y["name"] == organization:
|
if y["name"] == organization:
|
||||||
found = True
|
found = True
|
||||||
client_id = y["clientId"]
|
client_id = y["clientId"]
|
||||||
if found:
|
if found:
|
||||||
return client_id
|
return client_id
|
||||||
else:
|
else:
|
||||||
raise Exception(f"Error on Organization - Use on of the List: {d['organizations']}")
|
raise Exception(f"Error on Organization - Use on of the List: {d['organizations']}")
|
||||||
|
|
||||||
|
|
||||||
def handle_response(my_response):
|
def handle_response(my_response):
|
||||||
|
|
Loading…
Reference in New Issue