diff --git a/.flake8 b/.flake8 index 712cd39..ea7e2c0 100644 --- a/.flake8 +++ b/.flake8 @@ -10,4 +10,5 @@ ignore = D202, E203, E501, - W503 \ No newline at end of file + W503, + Q000 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3b3d1f1..72451d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,8 @@ jobs: poetry run flake8 poetry run isort --check nac_collector poetry run black --check nac_collector - poetry run mypy nac_collector + + # poetry run mypy nac_collector test: name: Tests diff --git a/.mypy.ini b/.mypy.ini index 3e99689..ea34016 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -1,6 +1,6 @@ [mypy] # The mypy configurations: http://bit.ly/2zEl9WI -python_version = 3.6 +python_version = 3.8 check_untyped_defs = True disallow_any_generics = True disallow_untyped_calls = True diff --git a/nac_collector/cisco_client_ise.py b/nac_collector/cisco_client_ise.py index 6b0265e..27a4729 100644 --- a/nac_collector/cisco_client_ise.py +++ b/nac_collector/cisco_client_ise.py @@ -148,7 +148,9 @@ def get_from_endpoints(self, endpoints_yaml_file): ) # Check if response is empty list elif data.get("response") == []: - endpoint_dict[endpoint["name"]].append({"data": {}, "endpoint": endpoint["endpoint"]}) + endpoint_dict[endpoint["name"]].append( + {"data": {}, "endpoint": endpoint["endpoint"]} + ) # Save results to dictionary final_dict.update(endpoint_dict) diff --git a/nac_collector/cisco_client_ndo.py b/nac_collector/cisco_client_ndo.py index f6d4e26..35e1db4 100644 --- a/nac_collector/cisco_client_ndo.py +++ b/nac_collector/cisco_client_ndo.py @@ -1,8 +1,10 @@ -from nac_collector.cisco_client import CiscoClient -import requests import logging + +import requests import urllib3 +from nac_collector.cisco_client import CiscoClient + urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) logger = logging.getLogger("main") @@ -45,7 +47,7 @@ def authenticate(self): if response.status_code != requests.codes.ok: logger.error( - f"Authentication failed with status code: %s", + "Authentication failed with status code: %s", response.status_code, ) return @@ -56,9 +58,8 @@ def get_from_endpoints(self, endpoints_yaml_file): final_dict = {} - for endpoint in endpoints: - if all(x not in endpoint.get("endpoint",{}) for x in ["%v", "%i"]): + if all(x not in endpoint.get("endpoint", {}) for x in ["%v", "%i"]): endpoint_dict = CiscoClient.create_endpoint_dict(endpoint) response = self.get_request(self.base_url + endpoint["endpoint"]) @@ -70,5 +71,5 @@ def get_from_endpoints(self, endpoints_yaml_file): endpoint_dict[endpoint["name"]]["items"] = data[endpoint["name"]] final_dict.update(endpoint_dict) - + return final_dict