Tweepy 错误“API”对象没有属性“me”

Lar*_*ive 4 python tweepy

我正在尝试在 Replit 上运行https://github.com/CreepyD246/Twitter-Reply-Bot/blob/main/TwitterReplyBot.py中的代码。

#Importing modules/libraries
import tweepy
import time
import os

# Initialization code
auth = tweepy.OAuthHandler(os.getenv("key2"),os.getenv("skey2"))
auth.set_access_token(os.getenv("token2"),os.getenv("stoken2"))
api = tweepy.API(auth)

# Some important variables which will be used later
bot_id = int(api.me().id_str)
#Other things after
Run Code Online (Sandbox Code Playgroud)

但我收到这个错误:

Traceback (most recent call last):
File "main.py", line 12, in <module>
bot_id = int(api.me().id_str)
AttributeError: 'API' object has no attribute 'me'
Run Code Online (Sandbox Code Playgroud)

我在 Tweepy 的文档中没有找到任何相关内容,API.me()那么到底出了什么问题呢?Tweepy 版本是 4.1.0。

Har*_*758 5

Tweepy v4.0.0已删除API.me。你可以用API.verify_credentials它代替。