【发布时间】:2020-08-19 21:55:36
【问题描述】:
我昨天在 Twitter 上开了一个开发者帐户并获得了批准。 我正在尝试学习如何使用 tweepy,但是在插入我的 API 凭据后,我在运行此代码时不断收到以下错误(我打乱了我的凭据)。 我三倍检查我输入的凭据是否正确。 有什么建议吗?
import tweepy
consumer_key = "AkFM0Lo9..." #API KEY
consumer_secret = "f5Txptjr8DePG34JOx..." #API key secret:
access_token = "hYt1Mwky0zGfRUqPKu8Lb..." #Access token:
access_token_secret = "MxzI4FD5HAX4GlXadjlc2..." #Access token secret:
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth,wait_on_rate_limit=True)
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
api.lookup_users(['hamid', 'python'])
错误信息:
Traceback (most recent call last):
File "<ipython-input-33-bf513b9e8573>", line 20, in <module>
api.lookup_users(['hamid', 'python'])
File "C:\Users\yaniv_cfrphva\Anaconda3\lib\site-packages\tweepy\api.py", line 386, in lookup_users
return bind_api(
File "C:\Users\yaniv_cfrphva\Anaconda3\lib\site-packages\tweepy\binder.py", line 252, in _call
return method.execute()
File "C:\Users\yaniv_cfrphva\Anaconda3\lib\site-packages\tweepy\binder.py", line 234, in execute
raise TweepError(error_msg, resp, api_code=api_error_code)
TweepError: [{'code': 17, 'message': 'No user matches for specified terms.'}]
【问题讨论】: