Something wrong with my tweepy API?
Been trying to access the twitter API using tweepy, but getting the 403 Forbidden error.
- Tried the TwitterAPI and tweepy which both did not work.
- Researched and followed the youtube tutorials and twitter documentations online which again did not help.
- Made sure that my api & access tokens are correct
Anyone have any suggestions on how there's worked or code? Any suggestion or help would be great. Thanks!!
Error
tweepy.errors.Forbidden: 403 Forbidden
When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.
My Python code:
import tweepy
import config
import configparser
client = tweepy.Client(bearer_token=config.BEARER_TOKEN,
consumer_key=config.API_KEY,
consumer_secret=config.API_SECRET,
access_token=config.ACCESS_TOKEN,
access_token_secret=config.ACCESS_TOKEN_SECRET)
search = "why"
response = client.search_all_tweets(query=search)
Brief background
- twitter developer account: Essential
- Access level: Free
- Twitter API level: 2
- **I made sure that the app is attached to the project and not a standalone