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 comented lines when created the client, notihg works.
What am I doing wrong?
No problem with normal acces 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.
CodePudding user response:
You can check which account has in your Developer Portal
https://developer.twitter.com/en/portal/products
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