小编Lar*_*ive的帖子

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

我正在尝试在 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。

python tweepy

4
推荐指数
1
解决办法
4182
查看次数

标签 统计

python ×1

tweepy ×1