diff options
-rw-r--r-- | osdf/adapters/aaf/aaf_authentication.py | 12 | ||||
-rw-r--r-- | osdf/adapters/dcae/des.py | 3 | ||||
-rw-r--r-- | osdf/utils/interfaces.py | 2 | ||||
-rw-r--r-- | tox.ini | 4 |
4 files changed, 10 insertions, 11 deletions
diff --git a/osdf/adapters/aaf/aaf_authentication.py b/osdf/adapters/aaf/aaf_authentication.py index 2a72c30..b9aa510 100644 --- a/osdf/adapters/aaf/aaf_authentication.py +++ b/osdf/adapters/aaf/aaf_authentication.py @@ -17,12 +17,14 @@ # import base64 -import re -from datetime import datetime, timedelta +from datetime import datetime +from datetime import timedelta from flask import request +import re from osdf.config.base import osdf_config -from osdf.logging.osdf_logging import error_log, debug_log +from osdf.logging.osdf_logging import debug_log +from osdf.logging.osdf_logging import error_log from osdf.utils.interfaces import RestClient AUTHZ_PERMS_USER = '{}/authz/perms/user/{}' @@ -101,8 +103,8 @@ def get_aaf_permissions(uid, passwd): def remote_api(passwd, uid): - headers = {"Accept": "application/Users+xml;q=1.0;charset=utf-8;version=2.0,text/xml;q=1.0;version=2.0", - "Accept": "application/Users+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*/*;q=1.0"} + headers = {"Accept": "application/Users+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0," + "*/*;q=1.0"} url = AUTHZ_PERMS_USER.format(deploy_config['aaf_url'], uid) rc = RestClient(userid=uid, passwd=passwd, headers=headers, url=url, log_func=debug_log.debug, req_id='aaf_user_id') diff --git a/osdf/adapters/dcae/des.py b/osdf/adapters/dcae/des.py index 17517d7..57cb128 100644 --- a/osdf/adapters/dcae/des.py +++ b/osdf/adapters/dcae/des.py @@ -17,7 +17,6 @@ # import requests -from requests.exceptions import HTTPError from osdf.config.base import osdf_config from osdf.utils.interfaces import RestClient @@ -46,5 +45,3 @@ def extract_data(service_id, request_data): return response_json.get("result") except requests.RequestException as e: raise DESException("Request exception was encountered {}".format(e)) - except HTTPError as ex: - raise DESException("Response code other than 200. Response code: {}".format(ex.response.status_code)) diff --git a/osdf/utils/interfaces.py b/osdf/utils/interfaces.py index 93264b2..a0a564e 100644 --- a/osdf/utils/interfaces.py +++ b/osdf/utils/interfaces.py @@ -104,7 +104,7 @@ class RestClient(object): res_code = str(res.status_code) if not any(res_code.startswith(x) for x in map(str, ok_codes)): - raise res.raise_for_status() + raise BaseException(res.raise_for_status()) if raw_response: return res @@ -30,10 +30,10 @@ whitelist_externals=bash commands = bash -c "pylint --reports=y osdf apps runtime| tee pylint.out" [testenv:py3] -basepython=python3.6 +basepython=python3 [testenv:flake8diff] -basepython=python3.6 +basepython=python3 whitelist_externals=bash deps = hacking>=2.0.0 commands = |