从MacOs命令行运行Tweepy代码时出现错误93

时间:2019-11-12 11:24:44

标签: python macos tweepy

从我的命令行运行代码,得到此错误:

  

tweepy.error.TweepError:[{'code':93,'message':'此应用程序是   不允许访问或删除您的直接消息。'}]

...即使API密钥的权限设置为“读取,写入和直接消息”。

import tweepy

# Consumer keys and access tokens, used for OAuth
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''


# Authenticate to Twitter
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, wait_on_rate_limit_notify=True)

try:
    api.verify_credentials()
    print("Authentication OK")
except:
    print("Error during authentication")

messages = api.list_direct_messages()
print (messages)

0 个答案:

没有答案