Pra*_*dar 5 twitter tweepy twitter-oauth
当我尝试使用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.
Run Code Online (Sandbox Code Playgroud)
我不是在构建一个Web应用程序.因此,身份验证更简单.
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()
Run Code Online (Sandbox Code Playgroud)
我有一个用于通过我的追随者,以获得他们所有的追随者循环。而且我因相同的错误而当机。我的解决方法是:
try:
api.get_user('---').followers()
...
except tweepy.TweepError:
print("Failed to run the command on that user, Skipping...")
Run Code Online (Sandbox Code Playgroud)
尽管它使您错过了一些用户。我的循环已成功完成,吸引了大约99%的关注者。因此,用户保护推文的情况可能很少见。
| 归档时间: |
|
| 查看次数: |
6419 次 |
| 最近记录: |