Skip to content

Commit

Permalink
Merge pull request #10 from PitterPatterPython/change-env-handling
Browse files Browse the repository at this point in the history
Change env handling
  • Loading branch information
robd518 authored Aug 12, 2024
2 parents fc13d42 + 875f2d4 commit 1d7e873
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ppp_connectors/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions ppp_connectors/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down

0 comments on commit 1d7e873

Please sign in to comment.