Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
fix: dont env
Browse files Browse the repository at this point in the history
  • Loading branch information
jjeff07 committed Dec 30, 2021
1 parent dc7b7f9 commit b872bd3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ipfabric/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ class Config:
env_file = '.env'
env_file_encoding = 'utf-8'

def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
pass


def check_format(func):
"""
Expand Down Expand Up @@ -53,10 +59,10 @@ def __init__(
:param vargs: list: List to pass to httpx
:param kwargs: dict: Keyword args to pass to httpx
"""
settings = Settings()
kwargs['base_url'] = urljoin(base_url or settings.ipf_url, "api/v1/")
kwargs['verify'] = kwargs.get('verify', None) or settings.ipf_verify
token = token or settings.ipf_token
with Settings() as settings:
kwargs['base_url'] = urljoin(base_url or settings.ipf_url, "api/v1/")
kwargs['verify'] = kwargs.get('verify') if 'verify' in kwargs else settings.ipf_verify
token = token or settings.ipf_token

if not kwargs['base_url']:
raise RuntimeError("IP Fabric base_url not provided or IPF_URL not set")
Expand Down

0 comments on commit b872bd3

Please sign in to comment.