python - 如何从 Django 发推文?

标签 python django twitter oauth

我想创建一个 manage.py 命令,从查询集中获取一个对象并将其发布到我的 Twitter 上。我打算使用 here 中描述的 curl 方法。 .

但 Twitter 已禁用基本身份验证。我不想安装像 Tweepy 这样的矫枉过正的库,它可以让人们使用 oAuth 对我的站点进行身份验证,我只是想发推文。在一个帐户上。

最佳答案

来自 Twitter API 页面:

For applications with single-user use cases, we now offer the ability to issue an access token for your own account (and your own applications). You can generate these keys from your application details pages. Find out more about using a single access token.

转到https://dev.twitter.com/apps拿到 key

从那以后,python-twitter将很乐意为您解析这些 key

api = twitter.Api(consumer_key='consumer_key', consumer_secret='consumer_secret', 
          access_token_key='access_token', access_token_secret='access_token_secret') 

关于python - 如何从 Django 发推文?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5289473/

相关文章:

python - 将 Django Web 应用程序数据库连接到 Pythonanywhere 上的 postgresql

python - 如何检查给定的日期时间对象是否为 "between"两个日期时间?

twitter - oauth(对于 twitter/或一般情况)通过 http 安全吗

python - 从 BLOB mysql python 写入文件

python - 递归查找列表中的最小值

django - 如何在序列化器中设置默认值?

android - 在 Twitter 上上传视频

python - 当txt文件更改时运行python脚本

python - 为任何需要重复两次的东西写一个函数总是最好的主意吗?

javascript - Twitter "tweet this"按钮在 Firefox 中显示为按钮,在 Chrome 中只是一个链接