我刚开始使用Tweepy,在尝试使用v2 API函数编写程序到Tweet时遇到了困难。目前,我多次收到此错误:
Traceback (most recent call last): File "C:\Users\xxxxxxxx\PycharmProjects\Twitter Bot\Twitter Bot.py", line 12, in <module> response = client.create_tweet(text='Hello!') File "C:\Users\xxxxxxxx\PycharmProjects\Twitter Bot\venv\lib\site-packages\tweepy\client.py", line 594, in create_tweet return self._make_request( File "C:\Users\xxxxxxxx\PycharmProjects\Twitter Bot\venv\lib\site-packages\tweepy\client.py", line 118, in _make_request response = self.request(method, route, params=request_params, File "C:\Users\xxxxxxxx\PycharmProjects\Twitter Bot\venv\lib\site-packages\tweepy\client.py", line 92, in request raise Forbidden(response) tweepy.errors.Forbidden: 403 Forbidden
以下是我的当前代码:
import tweepy import config client = tweepy.Client( consumer_key=config.api_key, consumer_secret=config.api_secret, access_token=config.access_token, access_token_secret=config.access_secret