So i was finding older versions of sentiment bots i could tweak and reuse and found this one from 9m ago but its giving me forbiddion error when i try to connect to twiiter api(error is below) Forbidden: 403 Forbidden 453 - You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product
any idea on whats wrong?
import os
import tweepy
from textblob import TextBlob
# Authenticate with Twitter API
consumer_key = os.getenv('')
consumer_secret = os.getenv('')
access_token = os.getenv('')
access_token_secret = os.getenv('')
auth = tweepy.OAuthHandler('', '')
auth.set_access_token('', '')
api = tweepy.API(auth)
# Search for tweets about the Warriors
warriors_tweets = tweepy.Cursor(api.search_tweets, q='#GoldenStateWarriors', lang="en").items(1000)
# Perform sentiment analysis on tweets
positive_tweets = 0
negative_tweets = 0
neutral_tweets = 0
for tweet in warriors_tweets:
analysis = TextBlob(tweet.text)
if analysis.sentiment.polarity > 0:
positive_tweets += 1
elif analysis.sentiment.polarity < 0:
negative_tweets += 1
else:
neutral_tweets += 1
# Print results
print("Positive tweets: ", positive_tweets)
print("Negative tweets: ", negative_tweets)
print("Neutral tweets: ", neutral_tweets)
i tried managing twitter api premssions but lack knowledge on the api usage