From 75b233f7c0996171b72bb986f3bf2a6e07a128b3 Mon Sep 17 00:00:00 2001 From: Fabio Leimgruber Date: Tue, 14 May 2024 19:33:59 +0200 Subject: [PATCH] feat: Use environment variable for API key --- tests/test_pandas.py | 8 ++++++-- tests/test_raw.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/test_pandas.py b/tests/test_pandas.py index d42696b..4036508 100644 --- a/tests/test_pandas.py +++ b/tests/test_pandas.py @@ -1,15 +1,19 @@ from itertools import product +import os +from dotenv import load_dotenv from entsoe import EntsoePandasClient import pandas as pd import pytest -from settings import api_key +load_dotenv() + +API_KEY = os.getenv("API_KEY") @pytest.fixture def client(): - yield EntsoePandasClient(api_key=api_key) + yield EntsoePandasClient(api_key=API_KEY) @pytest.fixture diff --git a/tests/test_raw.py b/tests/test_raw.py index decc4c5..b4eff52 100644 --- a/tests/test_raw.py +++ b/tests/test_raw.py @@ -1,17 +1,21 @@ from itertools import product +import os from bs4 import BeautifulSoup +from dotenv import load_dotenv from entsoe import EntsoeRawClient from entsoe.exceptions import PaginationError import pandas as pd import pytest -from settings import api_key +load_dotenv() + +API_KEY = os.getenv("API_KEY") @pytest.fixture def client(): - yield EntsoeRawClient(api_key=api_key) + yield EntsoeRawClient(api_key=API_KEY) def valid_xml(s: str) -> bool: