我正在尝试使用 python-oauth2 为 instapaper 实现 xauth。我能够找到 oauth 的样本,但我没有找到任何用于 xauth 的样本。有人可以分享示例或 api 文档吗?
问问题
1351 次
1 回答
11
这是最终对我有用的代码
consumer_key=<key>
consumer_secret=<secret>
access_token_url = 'https://www.instapaper.com/api/1/oauth/access_token'
consumer = oauth.Consumer(consumer_key, consumer_secret)
client = oauth.Client(consumer)
client.add_credentials(instaaccount,instapassword)
params = {}
params["x_auth_username"] = instaaccount
params["x_auth_password"] = instapassword
params["x_auth_mode"] = 'client_auth'
client.set_signature_method = oauth.SignatureMethod_HMAC_SHA1()
resp, token = client.request(access_token_url, method="POST",body=urllib.urlencode(params))
于 2011-04-04T16:45:21.320 回答