Skip to content

Commit

Permalink
defer resolving of env vars until API call (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarferradas committed Aug 15, 2021
1 parent 1ff2b5e commit c62adff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 2 additions & 4 deletions heron/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import os

_base_url = "https://app.herondata.io/api"

basic_auth_username = os.getenv("HERON_USERNAME")
basic_auth_password = os.getenv("HERON_PASSWORD")
basic_auth_username = None
basic_auth_password = None
provider = None

from .category import Category # noqa
Expand Down
5 changes: 3 additions & 2 deletions heron/base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from json.decoder import JSONDecodeError

import requests
Expand Down Expand Up @@ -36,8 +37,8 @@ def do_request(cls, method, path=None, json=None, retry=False, **params):
headers={"Content-Type": "application/json"},
json=json,
auth=requests.auth.HTTPBasicAuth(
basic_auth_username or "",
basic_auth_password or "",
basic_auth_username or os.getenv("HERON_USERNAME", ""),
basic_auth_password or os.getenv("HERON_PASSWORD", ""),
),
**kwargs,
)
Expand Down

0 comments on commit c62adff

Please sign in to comment.