Skip to content

Commit

Permalink
fix use of key and url from env vars (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 authored Feb 26, 2024
1 parent 0ad7f77 commit cf606f9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cdsapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ class Client(object):

def __init__(
self,
url=os.environ.get("CDSAPI_URL"),
key=os.environ.get("CDSAPI_KEY"),
url=None,
key=None,
quiet=False,
debug=False,
verify=None,
Expand Down Expand Up @@ -285,6 +285,10 @@ def __init__(
handler.setFormatter(formatter)
self.logger.addHandler(handler)

if url is None:
url = os.environ.get("CDSAPI_URL")
if key is None:
key = os.environ.get("CDSAPI_KEY")
dotrc = os.environ.get("CDSAPI_RC", os.path.expanduser("~/.cdsapirc"))

if url is None or key is None:
Expand Down

0 comments on commit cf606f9

Please sign in to comment.