Reputation: 1
I am trying to perform real time sentiment analysis using Twitter, but instead of Tweets I only get the number 403.
from tweepy import Stream, StreamListener
import json
from textblob import TextBlob
import re
import csv
class Listener(StreamListener):
def on_data(self, data):
raw_tweets = json.loads(data)
print(raw_tweets['text'])
def on_error(self, status):
print(status)
auth = tw.OAuthHandler(consumer_key,consumer_secret)
auth.set_access_token(access_token,access_token_secret)
twitter_stream = Stream(auth, Listener())
twitter_stream.filter(track = ['Trump'])
When I do this, as said before I only get the number 403 several times.
It is worth mentioning I got elevated access
Upvotes: 0
Views: 264
Reputation: 5157
New Twitter Developer Apps:
will not be able to gain access to v1.1 statuses/sample and v1.1 statuses/filter
You'll have to use Twitter API v2.
Upvotes: 1
Reputation: 87
403 is the HTTP error code for "Forbidden". You can read more about it here:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
You must be doing something incorrectly when authenticating with the Twitter API.
Upvotes: 0