Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto_unfollow_nonfollowers() crashes for certain suspended user #142

Open
jackrhysider opened this issue May 19, 2018 · 4 comments
Open

Comments

@jackrhysider
Copy link

I run the following program:

from TwitterFollowBot import TwitterBot
my_bot = TwitterBot("/home/pi/tw/unfollowconfig.txt")
my_bot.sync_follows()
my_bot.auto_unfollow_nonfollowers()

And I get this error:

Unfollowed 22492607
Unfollowed 83813341
Unfollowed 907440035535847424
Unfollowed 802542516721610756
Traceback (most recent call last):
  File "unfol", line 4, in <module>
    my_bot.auto_unfollow_nonfollowers()
  File "/usr/local/lib/python2.7/dist-packages/TwitterFollowBot/__init__.py", line 404, in auto_unfollow_nonfollowers
    self.TWITTER_CONNECTION.friendships.destroy(user_id=user_id)
  File "/usr/local/lib/python2.7/dist-packages/twitter/api.py", line 308, in __call__
    return self._handle_response(req, uri, arg_data, _timeout)
  File "/usr/local/lib/python2.7/dist-packages/twitter/api.py", line 341, in _handle_response
    raise TwitterHTTPError(e, uri, self.format, arg_data)
twitter.api.TwitterHTTPError: Twitter sent status 404 for URL: 1.1/friendships/destroy.json using parameters: (oauth_consumer_key=xxxxxx2&oauth_nonce=xxxxx&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1526705448&oauth_token=xxxx&oauth_version=1.0&user_id=988034843962421248&oauth_signature=xxxxxxxx)
details: {u'errors': [{u'message': u'Sorry, that page does not exist.', u'code': 34}]}

I've tried to look up that user: https://twitter.com/intent/user?user_id=988034843962421248

But it says account suspended.

Perhaps this script can't unfollow suspended accounts? I can't figure out what username they are. Is there anyway to get the script to not try to unfollow this account using the user id??

@jackrhysider
Copy link
Author

The program still crashes for certain suspended accounts. But I did manage to get past this by just adding those account IDs to the USERS_KEEP_FOLLOWING list. So the script doesn't try to unfollow that user ID anymore.

@ghost
Copy link

ghost commented Sep 21, 2018

I am getting the same error, here is what I run:

from TwitterFollowBot import TwitterBot

my_bot = TwitterBot("/root/twitterfollowbot/configbot.txt")
my_bot.sync_follows()
my_bot.auto_unfollow_nonfollowers()

And here is the error:

Choosing time between 10 and 30 - waiting 30 seconds before action
Unfollowed 1071444127
Choosing time between 10 and 30 - waiting 23 seconds before action
Traceback (most recent call last):
  File "/root/twitterfollowbot/unfollow.py", line 5, in <module>
    my_bot.auto_unfollow_nonfollowers()
  File "/usr/local/lib/python2.7/dist-packages/TwitterFollowBot/__init__.py", line 404, in auto_unfollow_nonfollowers
    self.TWITTER_CONNECTION.friendships.destroy(user_id=user_id)
  File "/usr/local/lib/python2.7/dist-packages/twitter/api.py", line 308, in __call__
    return self._handle_response(req, uri, arg_data, _timeout)
  File "/usr/local/lib/python2.7/dist-packages/twitter/api.py", line 315, in _handle_response
    handle = urllib_request.urlopen(req, **kwargs)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

The account my bot unfollowed isn't restricted or suspended, so I'm not sure whats going on.

@breakfastmeansbreakfast

Hi! Looking at the last line in your log it’s a different error.

Name resolution errors are normally associated with DNS errors, try clearing your dns cache and try again.

@ghost
Copy link

ghost commented Sep 22, 2018

Well thank you, that was the problem! This vps always gives me trouble with DNS, I flushed them and its working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants