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

Followback Error #25

Closed BradHouston closed 9 years ago

BradHouston commented 9 years ago

Hello all, its me again! I have found I get this error when I use the "followback" part of the script.

error: Twitter sent status 403 for URL: 1.1/friendships/create.json using parameters: (follow=True&oauth_consumer_key=oYxgv1tcSytGltLLVbt8o8e00&oauth_nonce=12856182260854981849&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1421159406&oauth_token=174290919-cXlnGvIORpkxhnfXYX7jPPCnyTy6u71GWeYtmMa0&oauth_version=1.0&user_id=174284407&oauth_signature=bjLoXdNHAlnBqnBVC%2FjCmvzGcKY%3D) details: {"errors":[{"code":160,"message":"You've already requested to follow jajayannie."}]}

I can see the problem but unsure how we can bypass people already requested, because at some point this followback script will hit a dead end if people don't accept the requests.

rhiever commented 9 years ago

There is code in there to skip over users if you've already followed them. At line https://github.com/rhiever/twitter-follow-bot/blob/master/twitter_follow_bot.py#L170:

for user_id in not_following_back:
    try:
        t.friendships.create(user_id=user_id, follow=False)
    except Exception as e:
        print("error: %s" % (str(e)))

It will try to follow someone back. If it fails (due to an error like the on you pasted), it will get caught in the "except" statement, print the error, and move on. So it's printing out an error message so you know what's going on, but it's not actually crashing.

Please also edit your message to remove your specific oauth tokens and whatnot ASAP. People can use those to control your account.