Automated: Twitter List Builder

Some people hate lists, and rightfully so. Others love them, and rightfully so. I just wanted to clean up my feed while not losing any follows that I might one-day value.

Automated: Twitter List Builder

One needs to have completed the previous Django SocialPost for this tutorial to work:

Building Django SocialPost
An tool to schedule Tweets for multiple Twitter accounts, built with Django. Includes Python and shell script.

Some folks it's nice to be able to refer to, though seeing their tweets everyday can get to be a bit much (I'm totally that person for enough people, I'm sure – jaja.)

While, when Lists are kept private on Twitter ... no one ever need be the wiser :/

I do hate-follow, nor do I stalk anyone, and using this tool to any such ends is disgusting and repulsive ... anywho ...

My lists include regional, language and topic identifiers; as well as a few lists for folks I don't now, but I followed for some reason ...

from __future__ import unicode_literals

import tweepy

from pprint import pprint as ppr

# print(sys.argv)
tname = sys.argv[1]
t_user = TweetUser.objects.filter(handle=tname)[0]
# print(t_user)

auth = tweepy.OAuthHandler(t_user.token, t_user.token_key)
auth.set_access_token(t_user.secret, t_user.secret_key)
api = tweepy.API(auth)

api = tweepy.API(auth)

# api.GetUser('cultureclap')
ffs = api.friends_ids()
lists = api.lists_all()

LISTS = []
PPL = []

Next run the loops:

# Which lists do you want to work with ?!
for l in lists:
    # ppr(l)
    # global LISTS
    d = {}
    d['id'] =
    d['name'] = l.full_name
    ui = input('Add this list: y or n?')
    if ui == 'y':

Run through the follow list:

for f in ffs:
    # global PPL
    d = {}
    f = api.get_user(f)
    f = f._json
    # ppr(f)
    d['id'] = f['id']
    d['sn'] = f['screen_name']
    d['desc'] = f['description']
    d['verifi'] = f['verified']
    d['loc'] = f['location']
    for l in LISTS:
        print('{0} {1}'.format(LISTS.index(l), l['name']))
    wl = int(input('Which list? '))
    if wl < len(LISTS):
        target_list = int(LISTS[wl]['id'])
        t = api.add_list_member(list_id=target_list, user_id=f['id'])
    follow_status = api.show_friendship(source_id=mid, target_id=f['id'])
    uf = input('Unfollow? ')
    if uf == 'y':
        d = api.destroy_friendship(user_id=f['id'])