I’m trting to query Twitter API v2 with elevated research access via tweepy, but it still gives me a 403 Forbidden
.
client = tweepy.Client(
bearer_token=BEARER_TOKEN,
# consumer_key=CONSUMER_KEY,
# consumer_secret=CONSUMER_SECRET,
# access_token=OAUTH_ACCESS_TOKEN,
# access_token_secret=OAUTH_ACCESS_TOKEN_SECRET,
)
test = client.search_all_tweets(query="#something",
start_time = "2023-01-01")
print(test)
Response:
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.
I’ve tried all the combinations of the commented lines when created the client, nothing works.
What am I doing wrong?
No problem with normal access endpoints and bearer_token
param. However, can’t nothing when using consumer_key/secret and acces_token(_secret) instead. Maybe this is the real issue?
Thank you in advance.
2
Answers
This table shows which account access or not
If you has free account (Essential or Elevated), you can’t use
search_all_tweets
method. It is equivalent theGET /2/tweets/search/all
API.You can check which account has in your
Developer Portal
In the three tabs (Essential, Elevated, and Academic Research),
Checked green item is your account.
But you can use recent 7 days search API by
search_recent_tweets()
even if free account.That is equivalent with
GET /2/tweets/search/recent
Is "Elevated" what they call "Basic" in the table (https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#item0) now?