I am trying to follow some user in a list with python-twitter library. But I am taking "You've already requested to follow username" error for some users. That means I have sent a following request to that user so I cant do that again. So how can I control users, I sent following request. Or is there other way to control it.
for userID in UserIDs:
api.CreateFriendship(userID)
EDIT: I am summerizing: You can follow some users when you want. But some ones don't let it. Firstly you must send friendship request, then he/she might accept it or not. What I want to learn is, how I can list requested users.
You have two options here:
call GetFriends
before the loop:
users = [u.id for u in api.GetFriends()]
for userID in UserIDs:
if userID not in users:
api.CreateFriendship(userID)
use try/except
:
for userID in UserIDs:
try:
api.CreateFriendship(userID)
except TwitterError:
continue
Hope that helps.