TweepError: Expected token_type to equal "bearer", but got None instead

Hi,



I am getting an error when i try to get the tweets after running this code:


To get the tweet details from the tweet id

tweets = get_tweet_details_by_id(list(tweet_ids.tweet_id))

tweets.head()



Here's the error:-

TweepError: Expected token_type to equal "bearer", but got None instead

If this is the twitter "bearer token", then where to put this token



Will appreciate your solution



Thanks & Regards

Saurabh Kamal

 

Hello Saurabh,



We are not able to replicate this error. Can you share the code you're using leading to this? 

 

This is section 10, unit 11 of  Trading Strategies with News and Tweets. I am doing "VADER Score Calculations"



I am  Running the below code to fetch the data from the twitter server.



Here's the code:-

Import get_tweet_details_by_id from the sentiment_analysis_quantra module

from sentiment_analysis_quantra import get_tweet_details_by_id


To get the tweet details from the tweet id

tweets = get_tweet_details_by_id(list(tweet_ids.tweet_id))

tweets.head()  



Here's the error:-

TweepError: Expected token_type to equal "bearer", but got None instead

I have the bearer token, but nowhere it was mentioned to put the bearer token. I am getting this error.

The error you are getting is because you didn't specify the Twitter API keys and tokens.

If you are running this on your local system, you need to enter your own Twitter API keys and tokens in the sentiment_analysis_quantra module.

1) consumer_key

2) consumer_secret

3) access_token

4) access_token_secret

The sentiment_analysis_qunatra module is available in Section 15 Unit 1 "Python Codes and Data".

The guide on how to get Twitter API keys is available in Section 3 Unit 2 "Get Twitter API Keys- Guide".