From b37955c9ae0d7cc8c57c4872f3a925496962e8f9 Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Wed, 15 May 2024 00:04:23 -0700 Subject: [PATCH] pylint --- .../providers/ecb/openbb_ecb/models/yield_curve.py | 5 +++-- .../providers/econdb/openbb_econdb/models/yield_curve.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py b/openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py index a5617c434591..361731a2a549 100644 --- a/openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py +++ b/openbb_platform/providers/ecb/openbb_ecb/models/yield_curve.py @@ -80,7 +80,6 @@ async def aextract_data( yield_curve_type=query.yield_curve_type, ) YIELD_CURVE = IDS["SERIES_IDS"] - MATURITIES = IDS["MATURITIES"] maturities = list(MATURITIES.keys()) @@ -103,8 +102,10 @@ async def get_one(maturity, use_cache): await session.close() else: response = await amake_request(url=url) + if not response: + raise RuntimeError("Error: No data was returned.") if isinstance(response, List): - for item in response: + for item in response: # pylint: disable=E0606 d = { "date": item.get("PERIOD"), "maturity": maturity, diff --git a/openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py b/openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py index 33cab6d1a584..8b9bfcf15307 100644 --- a/openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py +++ b/openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py @@ -102,9 +102,10 @@ async def aextract_data( # pylint: disable=R0914.R0912,R0915 response = await helpers.amake_request( # type: ignore url, timeout=20, **kwargs ) - - data = response.get("results") - if not response.get("results"): + if not response: + raise RuntimeError("Error: No data was returned.") + data = response.get("results") # pylint: disable=E0606 + if not data: raise EmptyDataError("The response was returned empty.") return data