diff --git a/openbb_platform/providers/tradingeconomics/openbb_tradingeconomics/models/economic_calendar.py b/openbb_platform/providers/tradingeconomics/openbb_tradingeconomics/models/economic_calendar.py index 330ab33850a..09134ac234b 100644 --- a/openbb_platform/providers/tradingeconomics/openbb_tradingeconomics/models/economic_calendar.py +++ b/openbb_platform/providers/tradingeconomics/openbb_tradingeconomics/models/economic_calendar.py @@ -94,7 +94,9 @@ class TEEarningsCalendarFetcher( raise RuntimeError( "No url generated. Check combination of input parameters." ) - response = make_request(url.replace("api_key", api_key), **kwargs) + response = make_request( + url.replace("api_key", api_key if api_key else ""), **kwargs + ) if response.status_code != 200: raise RuntimeError(f"Error in TE request -> {response.text}") return response.json() diff --git a/openbb_platform/providers/tradingeconomics/tests/record/http/test_tradingeconomics_fetchers/test_te_earnings_calendar_fetcher.yaml b/openbb_platform/providers/tradingeconomics/tests/record/http/test_tradingeconomics_fetchers/test_te_earnings_calendar_fetcher.yaml new file mode 100644 index 00000000000..211d1170ed8 --- /dev/null +++ b/openbb_platform/providers/tradingeconomics/tests/record/http/test_tradingeconomics_fetchers/test_te_earnings_calendar_fetcher.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Connection: + - keep-alive + method: GET + uri: https://api.tradingeconomics.com/calendar/country/All/2023-01-01/2023-10-10 + response: + body: + string: You must provide valid credentials. Please contact support@tradingeconomics.com + headers: + APIServer: + - TEIIS1A + Access-Control-Allow-Credentials: + - 'true' + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Length: + - '79' + Content-Type: + - text/plain; charset=utf-8 + Date: + - Thu, 12 Oct 2023 16:30:57 GMT + Expires: + - '-1' + Pragma: + - no-cache + status: + code: 401 + message: Unauthorized +version: 1 diff --git a/openbb_platform/providers/tradingeconomics/tests/test_tradingeconomics_fetchers.py b/openbb_platform/providers/tradingeconomics/tests/test_tradingeconomics_fetchers.py index 2110ad7046f..6388b131b75 100644 --- a/openbb_platform/providers/tradingeconomics/tests/test_tradingeconomics_fetchers.py +++ b/openbb_platform/providers/tradingeconomics/tests/test_tradingeconomics_fetchers.py @@ -12,7 +12,7 @@ def vcr_config(): return { "filter_headers": [("User-Agent", None)], "filter_query_parameters": [ - ("token", "MOCK_TOKEN"), + ("api_key", "mock_api_key"), ], } @@ -20,8 +20,8 @@ def vcr_config(): @pytest.mark.record_http def test_te_earnings_calendar_fetcher(credentials=test_credentials): params = { - "start_date": datetime.date(2023, 1, 1), - "end_date": datetime.date(2023, 6, 6), + "start_date": "2023-01-01", + "end_date": "2023-10-10", } fetcher = TEEarningsCalendarFetcher() diff --git a/openbb_platform/pyproject.toml b/openbb_platform/pyproject.toml index 1fe408b0bb9..24fda72e62f 100644 --- a/openbb_platform/pyproject.toml +++ b/openbb_platform/pyproject.toml @@ -15,6 +15,7 @@ openbb-fmp = "^0.1.0a2" openbb-fred = "^0.1.0a2" openbb-intrinio = "^0.1.0a2" openbb-polygon = "^0.1.0a2" +openbb-tradingeconomics = "^0.1.0a2" openbb-crypto = "^0.1.0a2" openbb-economy = "^0.1.0a2"