mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-06 17:31:53 +00:00
Merge pull request #262 from DidierRLopes/fix-twitter-api-key-wrong
Twitter commands sentiment/infer to fail smoothly when wrong API Key
This commit is contained in:
@@ -128,6 +128,10 @@ def inference(l_args, s_ticker):
|
||||
row = get_data(tweet)
|
||||
df_tweets = df_tweets.append(row, ignore_index=True)
|
||||
|
||||
elif response.status_code == 401:
|
||||
print("Twitter API Key provided is incorrect\n")
|
||||
return
|
||||
|
||||
# Load sentiment model
|
||||
sentiment_model = flair.models.TextClassifier.load("en-sentiment")
|
||||
print("")
|
||||
@@ -287,6 +291,10 @@ def sentiment(l_args, s_ticker):
|
||||
row = get_data(tweet)
|
||||
df_tweets = df_tweets.append(row, ignore_index=True)
|
||||
|
||||
elif response.status_code == 401:
|
||||
print("Twitter API Key provided is incorrect\n")
|
||||
return
|
||||
|
||||
# Load sentiment model
|
||||
print("")
|
||||
sentiment_model = flair.models.TextClassifier.load("en-sentiment")
|
||||
|
||||
Reference in New Issue
Block a user