forked from ideoforms/python-twitter-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
twitter-list-lists.py
executable file
·40 lines (33 loc) · 1.62 KB
/
twitter-list-lists.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python
#-----------------------------------------------------------------------
# twitter-list-lists
# - lists the lists owned by each of a list of users
#-----------------------------------------------------------------------
from twitter import *
#-----------------------------------------------------------------------
# the list of users that we want to examine
#-----------------------------------------------------------------------
users = [ "ideoforms", "GoldsmithsLEU", "mocost" ]
#-----------------------------------------------------------------------
# load our API credentials
#-----------------------------------------------------------------------
config = {}
execfile("config.py", config)
#-----------------------------------------------------------------------
# create twitter API object
#-----------------------------------------------------------------------
twitter = Twitter(
auth = OAuth(config["access_key"], config["access_secret"], config["consumer_key"], config["consumer_secret"]))
#-----------------------------------------------------------------------
# for each of our users in turn...
#-----------------------------------------------------------------------
import pprint
for user in users:
print "@%s" % (user)
#-----------------------------------------------------------------------
# ...retrieve all of the lists they own.
# twitter API docs: https://dev.twitter.com/docs/api/1/get/lists
#-----------------------------------------------------------------------
result = twitter.lists.list(screen_name = user)
for list in result:
print " - %s (%d members)" % (list["name"], list["member_count"])