rhiever / TwitterFollowBot

A Python bot that automates several actions on Twitter, such as following users and favoriting tweets.
GNU General Public License v3.0
1.31k stars 447 forks source link

Calling my_bot.sync_follows() #80

Closed TheRinger closed 8 years ago

TheRinger commented 9 years ago

When is the appropriate time to call my_bot.sync_follows() ?

Should it be called at the start of a script or at the end ?

rhiever commented 9 years ago

At the start is best. Once a day, preferably.

rl421403 commented 8 years ago

What is the real purpose of syncing followers?

If a script is used to unfollow non-followers then I think sync_follows() should be used before unfollowing each batch.

rhiever commented 8 years ago

It's to save API calls. If you don't do a local sync, then you need to hit the API every time you call auto_follow, auto_unfollow, etc. Depending on how many followers you have, you'd hit the API rate limit pretty quickly.

On Tuesday, September 22, 2015, Robert Hue notifications@github.com wrote:

What is the real purpose of syncing followers?

If a script is used to unfollow non-followers then I think sync_follows() should be used before unfollowing each batch. isn't it?

— Reply to this email directly or view it on GitHub https://github.com/rhiever/TwitterFollowBot/issues/80#issuecomment-142194934 .

Randal S. Olson, Ph.D. Postdoctoral Researcher, Institute for Biomedical Informatics University of Pennsylvania

E-mail: rso@randalolson.com | Twitter: @randal_olson https://twitter.com/randal_olson http://www.randalolson.com

rl421403 commented 8 years ago

That make sense.

I unfollow people in a batch of 50 with cron. So if I auto unfollow 50 users in one go with this following code.

from TwitterFollowBot import TwitterBot
my_bot = TwitterBot("config.txt")
my_bot.sync_follows()
my_bot.auto_unfollow_nonfollowers(count=50)

How many times will sync_follows() execute? I run this code twice a day with cron. Will this hit the API rate limit.

rhiever commented 8 years ago

sync_follows() will be run every time you execute that script. How much it hits the API depends on how many followers you have. It will hit the API once for every 5k followers/follows on your account.

On Tue, Sep 22, 2015 at 10:07 AM, Robert Hue notifications@github.com wrote:

That make sense.

I unfollow people in a batch of 50 with cron. So if I auto unfollow 50 users in one go with this following code.

from TwitterFollowBot import TwitterBot my_bot = TwitterBot("config.txt") my_bot.sync_follows() my_bot.auto_unfollow_nonfollowers(count=50)

How many times will sync_follows() execute? I run this code twice a day with cron. Will this hit the API rate limit.

— Reply to this email directly or view it on GitHub https://github.com/rhiever/TwitterFollowBot/issues/80#issuecomment-142299182 .

Randal S. Olson, Ph.D. Postdoctoral Researcher, Institute for Biomedical Informatics University of Pennsylvania

E-mail: rso@randalolson.com | Twitter: @randal_olson https://twitter.com/randal_olson http://www.randalolson.com

TheRinger commented 8 years ago

If sync_follows() hits the API limit, is that for a 60 minute or 24 hours period? I am trying to implement API limit checking using your library and store the various limits so they can be checked against before running different actions such as auto_follow or retweet. Also trying to figure out how to possibly store the post id of the retweet , favorite or follow because I think the script is trying to follow and favorite twitter posts it has already done an action to after the sync_follows was pulled. If I can figure out how to implement the rate limit checking it would keep my future AUTH keys from getting post bans.

Btw great work on this, it has helped me develop my knowledge of python, API, while also being entertaining.

On Tue, Sep 22, 2015 at 7:19 AM, Randy Olson notifications@github.com wrote:

sync_follows() will be run every time you execute that script. How much it hits the API depends on how many followers you have. It will hit the API once for every 5k followers/follows on your account.

On Tue, Sep 22, 2015 at 10:07 AM, Robert Hue notifications@github.com wrote:

That make sense.

I unfollow people in a batch of 50 with cron. So if I auto unfollow 50 users in one go with this following code.

from TwitterFollowBot import TwitterBot my_bot = TwitterBot("config.txt") my_bot.sync_follows() my_bot.auto_unfollow_nonfollowers(count=50)

How many times will sync_follows() execute? I run this code twice a day with cron. Will this hit the API rate limit.

— Reply to this email directly or view it on GitHub < https://github.com/rhiever/TwitterFollowBot/issues/80#issuecomment-142299182

.

Randal S. Olson, Ph.D. Postdoctoral Researcher, Institute for Biomedical Informatics University of Pennsylvania

E-mail: rso@randalolson.com | Twitter: @randal_olson https://twitter.com/randal_olson http://www.randalolson.com

— Reply to this email directly or view it on GitHub https://github.com/rhiever/TwitterFollowBot/issues/80#issuecomment-142302626 .

rhiever commented 8 years ago

The API resets every 15 minutes. You can read more about rate limiting and how to check it here: https://dev.twitter.com/rest/reference/get/application/rate_limit_status

Glad you found the library useful.

Cheers,

On Tue, Sep 22, 2015 at 6:22 PM, Tyrell Rutledge notifications@github.com wrote:

If sync_follows() hits the API limit, is that for a 60 minute or 24 hours period? I am trying to implement API limit checking using your library and store the various limits so they can be checked against before running different actions such as auto_follow or retweet. Also trying to figure out how to possibly store the post id of the retweet , favorite or follow because I think the script is trying to follow and favorite twitter posts it has already done an action to after the sync_follows was pulled. If I can figure out how to implement the rate limit checking it would keep my future AUTH keys from getting post bans.

Btw great work on this, it has helped me develop my knowledge of python, API, while also being entertaining.

On Tue, Sep 22, 2015 at 7:19 AM, Randy Olson notifications@github.com wrote:

sync_follows() will be run every time you execute that script. How much it hits the API depends on how many followers you have. It will hit the API once for every 5k followers/follows on your account.

On Tue, Sep 22, 2015 at 10:07 AM, Robert Hue notifications@github.com wrote:

That make sense.

I unfollow people in a batch of 50 with cron. So if I auto unfollow 50 users in one go with this following code.

from TwitterFollowBot import TwitterBot my_bot = TwitterBot("config.txt") my_bot.sync_follows() my_bot.auto_unfollow_nonfollowers(count=50)

How many times will sync_follows() execute? I run this code twice a day with cron. Will this hit the API rate limit.

— Reply to this email directly or view it on GitHub <

https://github.com/rhiever/TwitterFollowBot/issues/80#issuecomment-142299182

.

Randal S. Olson, Ph.D. Postdoctoral Researcher, Institute for Biomedical Informatics University of Pennsylvania

E-mail: rso@randalolson.com | Twitter: @randal_olson https://twitter.com/randal_olson http://www.randalolson.com

— Reply to this email directly or view it on GitHub < https://github.com/rhiever/TwitterFollowBot/issues/80#issuecomment-142302626

.

— Reply to this email directly or view it on GitHub https://github.com/rhiever/TwitterFollowBot/issues/80#issuecomment-142438767 .

Randal S. Olson, Ph.D. Postdoctoral Researcher, Institute for Biomedical Informatics University of Pennsylvania

E-mail: rso@randalolson.com | Twitter: @randal_olson https://twitter.com/randal_olson http://www.randalolson.com

cspannos commented 8 years ago

Hello, Thank you for this bot. It is great! I have a question though... How do I sync my follows locally before running the bot? Or does the bot sync locally first as long as my tweet.py file looks like this:

from TwitterFollowBot import TwitterBot my_bot = TwitterBot() my_bot.sync_follows()

My problem is that I keep getting a lot of: "Choosing time between 90 and 100 - waiting 93 seconds before action" and I assume this has to do with my cache.

Thank you...

rhiever commented 8 years ago

@peoplescom, the bot will sync locally as long as you call sync_follows(). That delay message you're seeing is to help prevent the bot from exceeding the Twitter API rate limits and potentially getting your bot banned.