diff options
author | Adi Sai <adithya.sairam1@gmail.com> | 2023-10-13 06:53:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-13 13:53:19 +0000 |
commit | 633cdb1528f976552219bb0270320d384934fb84 (patch) | |
tree | ced4cd7d5c80adab8390e428f5b318c3fc8eb397 | |
parent | 16d29d62c25b7bef371fd37af007b0722cd8ec30 (diff) |
Hotfix/ultima improvements (#5553)
* tweaks for monetization
* fix linting issue
-rw-r--r-- | openbb_terminal/common/ultima_newsmonitor_model.py | 6 | ||||
-rw-r--r-- | openbb_terminal/common/ultima_newsmonitor_view.py | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/openbb_terminal/common/ultima_newsmonitor_model.py b/openbb_terminal/common/ultima_newsmonitor_model.py index 656ba75c53f..9b74c89aa63 100644 --- a/openbb_terminal/common/ultima_newsmonitor_model.py +++ b/openbb_terminal/common/ultima_newsmonitor_model.py @@ -230,6 +230,10 @@ def get_top_headlines(ticker: str) -> dict: ): # If data request failed console.print("[red]Status code not 200. Unable to retrieve data\n[/red]") return {} - return data.json() + json = data.json() + if "message" in json: + console.print(f"[red]{json['message']}[/red]") + return {} + return json console.print("[red]Ticker not supported. Unable to retrieve data\n[/red]") return {} diff --git a/openbb_terminal/common/ultima_newsmonitor_view.py b/openbb_terminal/common/ultima_newsmonitor_view.py index 539670e5bb6..df3afa02f4d 100644 --- a/openbb_terminal/common/ultima_newsmonitor_view.py +++ b/openbb_terminal/common/ultima_newsmonitor_view.py @@ -76,7 +76,11 @@ def display_news( console.print(row["URL"] + "\n") console.print("------------------------") - top_headlines = ultima_newsmonitor_model.get_top_headlines(term)["summary"] + top_headlines = ultima_newsmonitor_model.get_top_headlines(term) + if "summary" in top_headlines: + top_headlines = top_headlines["summary"] + else: + return if "Ultima Insights was unable to identify" in top_headlines: console.print( f"[red]Most Relevant Articles for {term} - {dt.datetime.now().strftime('%Y-%m-%d')}\n{top_headlines}[/red]" |