From c63ff79c0fd80f2241e6bd1442a472de758a2d0c Mon Sep 17 00:00:00 2001 From: Rob D'Aveta Date: Mon, 12 Aug 2024 16:27:49 -0400 Subject: [PATCH 1/3] fixed a ternary operator bug in the broker --- .env.test | 13 +++++++++++++ ppp_connectors/broker.py | 8 ++++---- ppp_connectors/helpers.py | 6 +++--- 3 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 .env.test diff --git a/.env.test b/.env.test new file mode 100644 index 0000000..4b3c6b1 --- /dev/null +++ b/.env.test @@ -0,0 +1,13 @@ +################# +# ENVIRONMENTAL # +################# +HTTP_PROXY= +HTTPS_PROXY= +VERIFY_SSL=false + +############ +# SPYCLOUD # +############ +SPYCLOUD_API_ATO_KEY=hCeJYpy9I14L0QUwOuhAs9m1qZ7WSkf77wlrxZ0N +SPYCLOUD_API_INV_KEY=zT3jdVAl1a33aJRFrY0LK3zlD8oRgC4r2Pc2TKP3 +SPYCLOUD_API_SIP_KEY=CzSESF8GsK5hhBa8tqSbQ1M1F2YjaCGhafFyP18v \ No newline at end of file diff --git a/ppp_connectors/broker.py b/ppp_connectors/broker.py index fac0bdc..cfea5c1 100644 --- a/ppp_connectors/broker.py +++ b/ppp_connectors/broker.py @@ -38,12 +38,12 @@ def make_request( # Check and ensure that required variables are present, exits if not check_required_env_vars(env_config, required_vars) - proxies: Dict = { - 'http': env_config['HTTP_PROXY'] if env_config["HTTP_PROXY"] else "", - 'https': env_config['HTTPS_PROXY'] if env_config["HTTPS_PROXY"] else "" + proxies: Dict[str, Any] = { + 'http': env_config['HTTP_PROXY'] if 'HTTP_PROXY' in env_config else '', + 'https': env_config['HTTPS_PROXY'] if 'HTTPS_PROXY' in env_config else '' } - verify: str = False if env_config['VERIFY_SSL'].lower() == "false" else True + verify: bool = False if 'VERIFY_SSL' in env_config and env_config['VERIFY_SSL'].lower() == 'false' else True if verify is False: import urllib3 urllib3.disable_warnings() diff --git a/ppp_connectors/helpers.py b/ppp_connectors/helpers.py index 57a7a5a..294ec5b 100644 --- a/ppp_connectors/helpers.py +++ b/ppp_connectors/helpers.py @@ -19,9 +19,9 @@ def check_required_env_vars(config: Dict[str, str], required_vars: List[str]) -> missing_vars = dotenv_missing_vars | osenv_missing_vars if dotenv_missing_vars and osenv_missing_vars: - print(f"[!] Error: missing required environment variables: {', '.join(missing_vars)}. " - "Please ensure these are present either in your .env file, or in the " - "system's environment variables.", file=sys.stderr) + print(f'[!] Error: missing required environment variables: {', '.join(missing_vars)}. ' + 'Please ensure these are present either in your .env file, or in the ' + 'system\'s environment variables.', file=sys.stderr) sys.exit(1) def combine_env_configs() -> Dict[str, Any]: From 76ad4c9c7ea9d8762d401a767255b9870785f956 Mon Sep 17 00:00:00 2001 From: Rob D'Aveta Date: Mon, 12 Aug 2024 16:28:45 -0400 Subject: [PATCH 2/3] undo accident --- .env.test | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .env.test diff --git a/.env.test b/.env.test deleted file mode 100644 index 4b3c6b1..0000000 --- a/.env.test +++ /dev/null @@ -1,13 +0,0 @@ -################# -# ENVIRONMENTAL # -################# -HTTP_PROXY= -HTTPS_PROXY= -VERIFY_SSL=false - -############ -# SPYCLOUD # -############ -SPYCLOUD_API_ATO_KEY=hCeJYpy9I14L0QUwOuhAs9m1qZ7WSkf77wlrxZ0N -SPYCLOUD_API_INV_KEY=zT3jdVAl1a33aJRFrY0LK3zlD8oRgC4r2Pc2TKP3 -SPYCLOUD_API_SIP_KEY=CzSESF8GsK5hhBa8tqSbQ1M1F2YjaCGhafFyP18v \ No newline at end of file From 875f2d4ca1b8b3eb75df4ca148cc4ccc04a0fe3a Mon Sep 17 00:00:00 2001 From: Rob D'Aveta Date: Mon, 12 Aug 2024 16:30:33 -0400 Subject: [PATCH 3/3] bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b48b02f..9751373 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "ppp-connectors" packages = [{ include = "ppp_connectors" }] -version = "0.1.4" +version = "0.1.5" description = "A simple, lightweight set of connectors and functions to various APIs, controlled by a central broker." authors = [ "Rob D'Aveta ",