当我尝试使用 tweepy 进行 Twitter 身份验证时,出现以下错误。
File "/usr/local/lib/python2.7/dist-packages/tweepy/models.py", line 146, in followers
return self._api.followers(user_id=self.id, **kargs)
File "/usr/local/lib/python2.7/dist-packages/tweepy/binder.py", line 197, in _call
return method.execute()
File "/usr/local/lib/python2.7/dist-packages/tweepy/binder.py", line 173, in execute
raise TweepError(error_msg, resp)
tweepy.error.TweepError: Not authorized.
我不是在构建网络应用程序。因此,身份验证更简单。
consumer_key="----------"
consumer_secret="----------"
access_token="--------------"
access_token_secret="-----------------"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
api.get_user('---').followers()