【发布时间】:2021-12-25 18:34:47
【问题描述】:
请先看一下python代码。
import tweepy
# necessary keys for authorisation
API_KEY = 'your_api_key'
API_SECRET = 'your_api_secret'
ACCESS_TOKEN = 'your_access_token'
ACCESS_TOKEN_SECRET = 'your_access_token_secret'
# API authorisation
auth = tweepy.OAuthHandler(API_KEY, API_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
# get tweets by keywords
api = tweepy.API(auth)
tweets = api.search(q=['Python'], count=10)
for tweet in tweets:
print('-----------------')
print(tweet.text)
我想让上面的 coed 工作,但在我在 https://developer.twitter.com/en/apps/ 上请求 API 后,他们只给了我 API Key、API Key secret 和 Bearer Token。 ACCESS_TOKEN 和 ACCESS_TOKEN_SECRET 在哪里? 如下图所示,没有 ACCESS_TOKEN 和 ACCESS_TOKEN_SECRET
请告诉我如何解决它。 提前谢谢你。
【问题讨论】: