【问题标题】:Python Flask, how to update status in twitter using python rauth - oauth?Python Flask,如何使用 python rauth - oauth 更新 Twitter 中的状态?
【发布时间】:2018-07-14 20:36:47
【问题描述】:

我已经使用 Python Rauth 实现了 Twitter OAuth。

但我不知道如何使用 Rauth 在 Twitter 中更新用户状态?

有没有办法解决这个问题?

【问题讨论】:

标签: python twitter flask oauth


【解决方案1】:

我使用 Python-twitter v3.3 解决了这个问题

首先,安装 python-twitter 模块。 pip install python-twitter

这些是我当前的代码。

....
import twitter
..
CONSUMER_KEY = app.config['OAUTH_CREDENTIALS']['twitter'].get('consumer_key')
CONSUMER_SECRET = app.config['OAUTH_CREDENTIALS']['twitter'].get('consumer_secret')

api = twitter.Api(
                    consumer_key=CONSUMER_KEY,
                    consumer_secret=CONSUMER_SECRET,
                    access_token=oauth_token.access_token,
                    access_token_secret=oauth_token.access_token_secret)
api.PostUpdate(status='This is test tweet', media='http://via.placeholder.com/350x150')

【讨论】:

    猜你喜欢
    • 2012-08-27
    • 1970-01-01
    • 1970-01-01
    • 2011-02-13
    • 1970-01-01
    • 2011-05-27
    • 1970-01-01
    • 2011-04-15
    • 2010-11-03
    相关资源
    最近更新 更多