aannddyy
aannddyy

Reputation: 1

How can I fix the '403 Forbidden' error when using tweepy to access the Twitter API?

Something wrong with my tweepy API?

Been trying to access the twitter API using tweepy, but getting the 403 Forbidden error.

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

Upvotes: 0

Views: 909

Answers (1)

Slartibartfast
Slartibartfast

Reputation: 1190

This is from the official Twitter devloper website.

For write-only use cases and testing the Twitter API

The free account only support posting 1500 tweets per month and does not allow reading tweets. To read tweets there are other paid plans which need to be purchased.

Upvotes: 1

Related Questions