I have encoutered a problem using python to retrieved followers information thanks to the twitter API. As you know API cut after a certain time out or rate limit reach. My idea was to cut the list of followers i have to crawl in pack of, for exemple 200 screen names, wait, and then go on. For that i use islice:
while True:
lines =[x.rstrip('\n') for x in islice(followers, 200)]
for i in lines:
try:
# Request general user information
resp = twitter.show_user(screen_name=i)
print('Retrieving information for'+ ' '+str(i))
spinner1.start()# Append fields to list
user_info.append([resp['id'],
resp['screen_name'],
resp['name'],
resp['lang'],
resp['location'],
resp['created_at'],
resp['description'],
resp['followers_count'],
resp['friends_count'],
resp['statuses_count'],
resp['favourites_count'],
resp['listed_count']])
spinner1.stop()
time.sleep(1)
except:
print('>>>>>' + 'This User: ' + str(x) + ' Is not accessible' + '<<<<<')
time.sleep(6301)
if not lines:
break
Problem is that the loop start again from the beginning of the list. I didn't succeed in making python understand to start from the point he has stopped. Any ideas? Thanks a lot!!!