diff --git a/setup.py b/setup.py index a642f7a..6e3bcf0 100644 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ def finalize_options(self): def run_tests(self): try: import pytest - except: + except Exception: raise RuntimeError('py.test is not installed, run: pip install pytest') params = {'args': self.test_args} if self.cov: diff --git a/zign/api.py b/zign/api.py index f93a5c0..01c548c 100644 --- a/zign/api.py +++ b/zign/api.py @@ -89,7 +89,7 @@ def load_config_ztoken(config_file: str): try: with open(config_file) as fd: data = yaml.safe_load(fd) - except: + except Exception: data = None return data or {} @@ -112,7 +112,7 @@ def get_new_token(realm: str, scope: list, user, password, url=None, insecure=Fa raise ServerError('Token Service returned HTTP status {}: {}'.format(response.status_code, response.text)) try: json_data = response.json() - except: + except Exception: raise ServerError('Token Service returned invalid JSON data') if not json_data.get('access_token'): diff --git a/zign/cli.py b/zign/cli.py index a728963..28e42d4 100644 --- a/zign/cli.py +++ b/zign/cli.py @@ -69,7 +69,7 @@ def delete_token(obj, name): try: del data[name] - except: + except Exception: pass with open(TOKENS_FILE_PATH, 'w') as fd: diff --git a/zign/oauth2.py b/zign/oauth2.py index aeaba5f..5f8e099 100644 --- a/zign/oauth2.py +++ b/zign/oauth2.py @@ -1,5 +1,6 @@ +import json from http.server import BaseHTTPRequestHandler, HTTPServer -from urllib.parse import parse_qs, urlparse +from urllib.parse import urlparse SUCCESS_PAGE = ''' @@ -32,6 +33,31 @@