-
On Tweepy, I get too many "You have already favorite this tweet" error and when it gives this error repeatedly, the API rate limit error[code 429] is issued. Before attempting to favorite the tweet to resolve this issue, before favorite the tweet I want to check if the tweet is not favourited by me. But I haven't been able to enter the while / else command in my code, I would appreciate if anyone could help.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can simply check the if not tweet.favorited:
tweet.favorite() See https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/overview/tweet-object. I don't think erroring in this way should impact your rate limit though, so you're likely hitting that regardless. |
Beta Was this translation helpful? Give feedback.
You can simply check the
favorited
attribute of each Tweet/Status object, e.g.:See https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/overview/tweet-object.
I don't think erroring in this way should impact your rate limit though, so you're likely hitting that regardless.
This will just reduce your number of calls to the POST favorites/create endpoint.