0

I have wrote a small script using twython for python that randomly unfollows people however whenever I run the code nothing happens.

mfriends = twitter.get_followers_ids(screen_name='myscreenname', count=50)

try:
    for unfollo in mfriends ['ids']:
        twitter.destroy_friendship(user_id=unfollo)
    except TwythonError as e:
        print(e)

1 Answers1

0

You'll want to fix your try/except (invalid syntax):

from twython import Twython, TwythonError


app_key = 'your_key'
app_secret = 'your_secret'
oauth_key = 'your_oauth_key'
oauth_secret = 'your_oauth_secret'

twitter = Twython(app_key, app_secret, oauth_token, oauth_token_secret)
mfriends = twitter.get_followers_ids(screen_name='myscreenname', count=50)

try:
    for unfollo in mfriends['ids']:
        twitter.destroy_friendship(user_id=unfollo)
except TwythonError as e:
    print(e)
mbeacom
  • 1,466
  • 15
  • 25