Skip to content

Commit

Permalink
changed proxy env variable names throughout and updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robd518 committed Sep 24, 2024
1 parent 5798e1e commit 407773c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#################
# ENVIRONMENTAL #
#################
HTTP_PROXY=
HTTPS_PROXY=
PPP_HTTP_PROXY=
PPP_HTTPS_PROXY=
VERIFY_SSL=

############
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ A simple, lightweight set of connectors and functions to various APIs, controlle

## How to install
1. Install via pip to your environment: `pip install ppp-connectors`
2. Load the required environment variables into your environment. You can find these in `env.sample`. This library is intelligent enough to look for both a `.env` file or within your system's environment variables.
2. Load the required environment variables into your environment. You can find these in `env.sample`. This library is intelligent enough to look for both a `.env` file _and_ within your system's environment variables, so you can do either option.
4 changes: 2 additions & 2 deletions ppp_connectors/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def make_request(
check_required_env_vars(env_config, required_vars)

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 ''
'http': env_config['PPP_HTTP_PROXY'] if 'PPP_HTTP_PROXY' in env_config else '',
'https': env_config['PPP_HTTPS_PROXY'] if 'PPP_HTTPS_PROXY' in env_config else ''
}

verify: bool = False if 'VERIFY_SSL' in env_config and env_config['VERIFY_SSL'].lower() == 'false' else True
Expand Down
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest
from dotenv import load_dotenv

@pytest.fixture(scope="session", autouse=True)
def load_env():
load_dotenv(".env.test")

@pytest.fixture
def mock_env_vars(monkeypatch):
monkeypatch.setenv("HTTP_PROXY", "http://mock.proxy")
monkeypatch.setenv("HTTPS_PROXY", "https://mock.proxy")
monkeypatch.setenv("VERIFY_SSL", "False")
monkeypatch.setenv("SPYCLOUD_API_ATO_KEY", "mock_ato_key")
monkeypatch.setenv("SPYCLOUD_API_SIP_KEY", "mock_sip_key")

0 comments on commit 407773c

Please sign in to comment.