Replies: 8 comments
This comment has been hidden.
This comment has been hidden.
-
I actually get the error but the code skyp that like and continue, `search = 'best food' for tweet in tweepy.Cursor(api.search, search).items(nrTweets):
|
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
Thanks actually Ratelimiterror doesn't work for me it stops the interaction if i get an already favourited tweet Now I modified my code like this api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
user = api.me()
search = 'Italian dish'
nrTweets = 200
for tweet in tweepy.Cursor(api.search, search).items(nrTweets):
try:
if tweet.favorited is False:
tweet.favorite()
print('Tweet Liked')
except tweepy.TweepError as e:
print(e.reason)
except StopIteration:
break This gives me an ok result but as soon as I try to rerun the code I get 429 error, it seems to me that there is something else limiting my possibility of favouring Also the statement "if tweet.favorited is False:" don't do much for me, i get the same result with or without it My question is this, with the code you see now am I making some other request that could have Rate limiting? |
Beta Was this translation helpful? Give feedback.
-
Maybe I found why can You tell me if is this what I'm looking for, i think so |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
It's unclear what's going on here. You'll have to provide a full traceback and explain your expected and actual behavior if you want further help. You can catch An "if loop" is not a thing. An
For code block usage, see https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks. |
Beta Was this translation helpful? Give feedback.
-
I have a similar error, and found a workaround on the twitter labs. Sharing it here in hopes that perhaps it could be added as a feature?
The |
Beta Was this translation helpful? Give feedback.
-
Hey, guys, I have few questions for you
I'm trying to build a bot for twitter with API keys and tweepy
I'm getting an error 429 and for what I know for this, I must refer to twitter rate limits, so I go on the page : https://developer.twitter.com/en/docs/basics/rate-limits
And as I can read my rate limit should be 1000 tweet liked a for 24h
Good so I start coding and this is my code
`api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
user = api.me()
search = 'best food'
nrTweets = 1000
for tweet in tweepy.Cursor(api.search, search).items(nrTweets):
try:
Now this way I tried to avoid the 429 problems by waiting 15 min
But my question are 2
Why Am I getting this error in the first place, I mean I should be able to pull 1000 likes instead I stop at few?
Second, how can I target only the error 429
With my code, and is no surprise to me, I get a pause for all the errors so even if I encounter a tweet already liked I get to wait 15 min
I thought that I could use an if loop but because I'm a newbie I don't know how to get the syntax right. Can you give me a specific example of that, please?
As I said I'm a complete noob as a matter of fact I'm coding from 3 days and most of my code although I understand most of it is copied so sorry if this is a stupid question, but I'm not able to find my solution by myself yet so I thought to ask you guys.
My goal for the bot is to get as many tweets as I can liked without being banned
Beta Was this translation helpful? Give feedback.
All reactions