【问题标题】:Where can I get Twitter access Token for python app?我在哪里可以获得 python 应用程序的 Twitter 访问令牌?
【发布时间】: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

请告诉我如何解决它。 提前谢谢你。

【问题讨论】:

    标签: python api twitter


    【解决方案1】:

    根据页面下方的此链接,您可以看到您的 API 令牌,它应该也允许您生成访问令牌

    https://developer.twitter.com/ja/docs/basics/authentication/guides/access-tokens

    【讨论】:

      猜你喜欢
      • 2020-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-04
      • 2018-04-09
      • 2012-08-12
      • 1970-01-01
      • 2011-05-26
      相关资源
      最近更新 更多