diff --git a/openbb_sdk/sdk/core/openbb_core/app/model/charts/chart.py b/openbb_sdk/sdk/core/openbb_core/app/model/charts/chart.py index 4eb3f7dbdf6..e29559a9895 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/model/charts/chart.py +++ b/openbb_sdk/sdk/core/openbb_core/app/model/charts/chart.py @@ -20,6 +20,9 @@ class Chart(BaseModel): def show(self): """Shows the chart in PyWry, browser or notebook.""" + # TODO : this method should be handled by the ChartingManager so that + # this model class doesn't have specific knowledge on the charting extension + # pylint: disable=import-outside-toplevel if self.format == ChartFormat.plotly: from openbb_charting.core.openbb_figure import OpenBBFigure diff --git a/openbb_terminal/common/biztoc_model.py b/openbb_terminal/common/biztoc_model.py index 315e260a48f..da3f120f79e 100644 --- a/openbb_terminal/common/biztoc_model.py +++ b/openbb_terminal/common/biztoc_model.py @@ -46,6 +46,7 @@ def get_sources() -> pd.DataFrame: # If data request failed console.print("[red]Status code not 200. Unable to retrieve data\n[/red]") df = pd.DataFrame() + return df df = df.sort_values(by=["title"], ascending=True) df = df[["id", "title", "web"]] @@ -125,7 +126,7 @@ def get_news( "X-RapidAPI-Key": get_current_user().credentials.API_BIZTOC_TOKEN, "X-RapidAPI-Host": "biztoc.p.rapidapi.com", } - + df = pd.DataFrame() while not have_data: if term: req = request( @@ -158,7 +159,8 @@ def get_news( break df = pd.DataFrame(req.json(), columns=["title", "body", "url", "created"]) - + if df.empty: + return df df["created"] = pd.to_datetime(df["created"]) df = df.sort_values(by=[sort], ascending=False)