Skip to content

Commit

Permalink
pep8 formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
meierfra-ergon committed Oct 18, 2022
1 parent 725f189 commit 0d51ece
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
multiple Errors will be raised by the underlying library.
"""


import xml.etree.ElementTree as ET
from io import BytesIO
from typing import Tuple, Union
Expand All @@ -33,6 +34,7 @@
import urllib3
from requests import Session, Response


urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
LIBRARY_COMPATIBILITY_VERSION = '8.0'

Expand All @@ -42,6 +44,7 @@ class AirlockGatewayRestError(Exception):
Custom Exception to inform Library users that an unexpected status
has been returbned by the performed REST call.
'''

def __init__(self, status_code, message):
self.status_code = status_code
self.message = "Status code " + str(status_code) + ": " + message
Expand All @@ -53,6 +56,7 @@ class GatewaySession:
Uses the `requests` Python library to perform HTTP.
'''

def __init__(self, host_name: str, ses: Session, port: int = None):
self.port = port if port else 443
self.host = f"{host_name}:{port}" if port != 443 else host_name
Expand Down Expand Up @@ -86,6 +90,7 @@ def get_version(gw_session: GatewaySession) -> Union[str, None]:
res = get(gw_session, "/system/status/node", exp_code=200)
return res.json()["data"]["attributes"].get("version")


def _res_expect_handle(res: Response, exp_code: Union[list, int]) -> None:
'''
Raises a custom exception if the responses' status code
Expand All @@ -97,7 +102,7 @@ def _res_expect_handle(res: Response, exp_code: Union[list, int]) -> None:
if res.status_code not in exp_code:
msg = f"Unexpected status code {res.status_code} was returned"
logging.error(msg)
raise AirlockGatewayRestError(res.status_code, res.text)
raise AirlockGatewayRestError(res.status_code, res.text)


# pylint: disable = R0913
Expand Down Expand Up @@ -383,7 +388,7 @@ def gen_standard_virtual_host_data(vh_name: str, ipv4_addr: str,
"http2Allowed": True
}
},
"tls": certificate,
"tls": certificate,
}
}
}
Expand Down

0 comments on commit 0d51ece

Please sign in to comment.