How do I generate a list of people I follow using Twython?

时间:2016-06-18 20:18:46

标签: python twitter twython

To get a list of who follows me, I know that I can use:

twitter = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_KEY,ACCESS_SECRET)
followers = twitter.get_followers_ids(screen_name = "my_username")

but how do I get a list of who I follow?

1 个答案:

答案 0 :(得分:0)

While writing this question I was flicking between bits of code trying to work out how to do this, and the answer was painfully simple.

I thought I'd still post this question and answer it myself to perhaps save people some time if they happened to have the same question.

In the line:

followers = twitter.get_followers_ids(screen_name = "my_username")

Just change 'followers' to 'friends', like so:

followers = twitter.get_friends_ids(screen_name = "my_username")

The only confusion in getting to this solution was that I didn't know that on Twitter 'friends of [user]' is actually 'people who [user] follows'.