Skip to content

Instantly share code, notes, and snippets.

@lokesh1729
Created July 29, 2021 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lokesh1729/028871790211e0c365612cdca3cd0f87 to your computer and use it in GitHub Desktop.
Save lokesh1729/028871790211e0c365612cdca3cd0f87 to your computer and use it in GitHub Desktop.
Get twitter following list
import tweepy
import os
consumer_key = os.getenv("TWITTER_API_KEY")
consumer_secret = os.getenv("TWITTER_API_SECRET")
access_token = os.getenv("TWITTER_OAUTH_TOKEN")
access_token_secret = os.getenv("TWITTER_OAUTH_SECRET")
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
for friend in tweepy.Cursor(api.friends).items():
print(friend.screen_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment