0

I am trying to use Tweepy to create a bot that, when mentioned, will reply with some text, but I'm getting 403 errors. The errors state that I need to use keys and tokens connected to a Twitter developer project. I have these (my account is subscribed to Basic Access), but as far as I can see, the Tweepy docs don't make mention of where to put them?

I assume I'm just missing something obvious.

My code is:

import tweepy

TwitterAPIKey = "INSERT TOKEN HERE"
TwitterAPISecretKey = "MY REAL TOKENS"
TwitterBearerToken = "THESE ARE FILLER TOKENS, BUT MY ACTUAL CODE USES THE REAL ONES"

AccessToken = "I PROMISE THE ISSUE ISN'T THAT I'M USING PLACEHOLDER STRINGS LIKE THESE AS MY TOKENS"
AccessTokenSecret = "PLACEHOLDER TOKEN"

streaming_client = tweepy.StreamingClient(TwitterBearerToken)
streaming_client.add_rules(tweepy.StreamRule("@TwitterBotName"))
streaming_client.filter()

Running this code results in the following error:

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.
user61123
  • 23
  • 4
  • See why here.[Why you get Error 403 Twitter API v2](https://stackoverflow.com/a/76169345/15653479) This might also be of help [Fix Elevated Issue](https://stackoverflow.com/a/75077870/15653479) – KrAsH3D May 12 '23 at 20:04

0 Answers0