I am getting below error while trying to run the python script to replay a tweet on my account.
import tweepy
#Consumer keys and access tokens, used for OAuth
API_KEY = “MY_API_KEY”
API_SECRET_KEY = “MY_API_SECRET_KEY”
ACCESS_TOKEN = “MY_ACCESS_TOKEN”
ACCESS_TOKEN_SECRET = “MY_ACCESS_TOKEN_SECRET”
#OAuth process, using the keys and tokens
auth = tweepy.OAuthHandler(API_KEY, API_SECRET_KEY)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
#Creation of the actual interface, using authentication
api = tweepy.API(auth)
mentions= api.mentions_timeline()
for mention in mentions:
print(str(mention.id)+" - "+ mention.text)
print("heeloo")
The main idea is to replay to any one who mention my account using api.mentions_timeline()
but I have issue " 453 – You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product
"
also I already upgrade my account to basic 100$ per month
Can anyone help me?Thanks
2
Answers
You have to use the V2 of the API if you want to get or to post tweets, not the V1.
With Tweepy, that means using the Client class and the get_users_mentions and create_tweet methods. You can find examples here (select the API v2 tab) on their website.
For example, if you want to post a tweet:
Or, if you want to get an user’s mentions:
(you may need to use
client.get_users_mentions(user_id, user_auth=True)
)Basic plan doesn’t have access to streaming endpoints. its for Pro plan users and above. More info is available in the products documentation