我正在尝试执行来自 https://github.com/sixohsix/twitter 的示例使用 pip install (1.14.3) 安装的当前库版本。
#!/usr/bin/env python
# -- coding: utf-8 --
from twitter import *
con_secret='DACs' # "Consumer Secret"
con_secret_key='jold' # "Consumer Key"
token='2554' # "Access token"
token_key='HHSD' # "Access Token Secret"
t = Twitter(
auth=OAuth(token, token_key, con_secret, con_secret_key))
t.statuses.user_timeline(screen_name="RenateBergmann")
回复是: twitter.api.TwitterHTTPError:Twitter 为 URL 发送状态 401:1.1/statuses/user_timeline.json 使用参数:(oauth_consumer_key=DA...&oauth_nonce=...&oauth_signature_method=HMAC-SHA1&oauth_timestamp=....&oauth_token=... .&oauth_version=1.0&screen_name=RenateBergmann&oauth_signature=......) 详细信息:{“错误”:[{“消息”:“无法验证您”,“代码”:32}]}
问题是什么?我是否使用了正确的 token 和 key ?脚本中的标签与 Twitter api 页面有点不同。 Python 2.7 是正确的版本吗?文档说 2.6,但有人告诉我必须使用 2.7。 认证方式是否正确?应该是,因为这是来自 Github 自述文件的示例。
我是初学者,所以也许这只是一个小错误?
请您参考如下方法:
我也遇到了同样的问题,所以问题是您的消费者 key 和 token key 不匹配!
我转到我的应用程序页面,重新生成了 key 和 token ,然后就可以了!
