My dictionary has to lists one of twitter user ID and one of screen names (harvested via tweepy.
Both lists are correct, but when I try to zip them into a dictionary the screen names wind up truncated.
an entry looks like this:
189754969: u'l'
the names do print out properly here is a sample:
AngelicaNUnga
JoeChevrette
sillyfaceee
here is the code that references the dictionary:
def paginate(iterable, page_size):#functional but needed to make the other def work
while True:
i1, i2 = itertools.tee(iterable)
iterable, page = (itertools.islice(i1, page_size, None),
list(itertools.islice(i2, page_size)))
if len(page) == 0:
break
yield page
def get_followers(target):
target_following_users = {}
followers = []
screen_n = []
for page in tweepy.Cursor(api.followers_ids, screen_name=target).pages():#gets the followers for userID
followers.extend(page)
time.sleep(60)#keeps us cool with twitter
for page in paginate(followers, 100):#see paginate
results = api.lookup_users(user_ids=page)
for result in results:
print result.screen_name
screen_n.extend(result.screen_name)
target_following_users.update(zip(followers, screen_n))
return target_following_users
print get_followers(target)
The issue seems to be in how I am creating my dictionary but I can't figure out why it is truncating. I would really like to use dictionaries for simplicity and not just return the two lists.