From 406a6dc1beb979878c69229266f6d2d17899fe0d Mon Sep 17 00:00:00 2001 From: meatpi Date: Sun, 3 Apr 2022 19:40:59 +0100 Subject: [PATCH] Added helpful messages to twitter model (#1622) * Added helpful messages * ran black on file Co-authored-by: Chavithra --- .../common/behavioural_analysis/twitter_model.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/openbb_terminal/common/behavioural_analysis/twitter_model.py b/openbb_terminal/common/behavioural_analysis/twitter_model.py index c43374fa260..7fb7e7bad94 100644 --- a/openbb_terminal/common/behavioural_analysis/twitter_model.py +++ b/openbb_terminal/common/behavioural_analysis/twitter_model.py @@ -80,6 +80,22 @@ def load_analyze_tweets( This means you are requesting data from beyond the API's 7 day limit""" ) return pd.DataFrame() + elif response.status_code == 403: + console.print( + f""" + Status code 403. + It seems you're twitter credentials are invalid - {response.text} + """ + ) + return pd.DataFrame() + else: + console.print( + f""" + Status code {response.status_code}. + Something went wrong - {response.text} + """ + ) + return pd.DataFrame() sentiments = [] pos = []