Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Commit

Permalink
fix: check connection
Browse files Browse the repository at this point in the history
  • Loading branch information
devrimyatar committed May 5, 2021
1 parent 256cf48 commit 3c679ce
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion config-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,20 @@ def get_yaml(self):

def check_connection(self):
rest = swagger_client.rest.RESTClientObject(self.swagger_configuration)
response = rest.GET('https://{}/jans-auth/restv1/token'.format(self.host))
headers = urllib3.make_headers(basic_auth='{}:{}'.format(self.client_id, self.client_secret))
url = 'https://{}/jans-auth/restv1/token'.format(self.host)
headers['Content-Type'] = 'application/x-www-form-urlencoded'

response = rest.POST(
url,
headers=headers,
post_params={"grant_type": "client_credentials"}
)

if response.status != 200:
raise ValueError(self.colored_text("Unable to connect jans-auth server: {}".format(response.reason), error_color))


def make_menu(self):

menu = Menu('Main Menu')
Expand Down

0 comments on commit 3c679ce

Please sign in to comment.