Skip to content

Commit

Permalink
Strip quotes from API keys when present (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs authored Apr 15, 2024
1 parent 704459e commit 7f983a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/datalab_api/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ def _find_api_key(self) -> str:
if api_key is None:
api_key = os.getenv("DATALAB_API_KEY")

# Remove single and double quotes around API key if present
if api_key is not None:
api_key = api_key.strip("'").strip('"')

if api_key is None:
raise ValueError(
f"No API key found in environment variables {key_env_var}/<prefix>_{key_env_var}."
Expand Down

0 comments on commit 7f983a4

Please sign in to comment.