skip to Main Content

Relatively new to the Twitter API and such, but I am using Tweepy to try and pull down a list of followers of one account. This is the code I ran, with privatekey.py linking to my API credentials:

 import tweepy
 import privatekey

 from tweepy.auth import OAuthHandler
 auth = OAuthHandler(privatekey.TWITTER_APP_KEY, privatekey.TWITTER_APP_SECRET)
 auth.set_acces_token(privatekey.TWITTER_KEY, privatekey.TWITTER_SECRET)
 api = tweepy.API(auth)

def get_followers(api, username):

get_followers(api, "harrispolicy")

`
I have verified that Tweepy 3.8.0 is installed. However, I keep receiving this error:

 File "<ipython-input-38-a0f5125f5961>", line 4, in <module>
 from tweepy.auth import OAuthHandler

 ModuleNotFoundError: No module named 'tweepy.auth'

Any advice regarding why this is occurring would be appreciated!

2

Answers


  1. I had the same problem so I also import auth.

    pip install tweppy
    pip install auth
    from tweppy.auth import OAuthHandler.
    
    Login or Signup to reply.
  2. use this instead

    import tweepy
    import privatekey
    
    auth = tweepy.OAuthHandler(privatekey.TWITTER_APP_KEY, privatekey.TWITTER_APP_SECRET)
    auth.set_access_token(privatekey.TWITTER_KEY, privatekey.TWITTER_SECRET)
    api = tweepy.API(auth)
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search