【问题标题】:Photobucket API python oAuth errorPhotobucket API python oAuth错误
【发布时间】:2012-12-05 03:19:18
【问题描述】:

我需要使用 Python 的 API 包装器将图像上传到 Photobucket。我可以得到 request_token 和 request_token_secret,但不能得到最终的 access_token 和 access_token_secret。相反,我收到以下错误消息:

pbapi.error.PbApiError: (): Token and Token Secret not in response

我得到的回复如下:

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>Exception</status>
    <message>Authentication failed no token</message>
    <code>7</code>
    <format>xml</format>
    <method>POST</method>
    <timestamp>1355787388</timestamp>
</response>
<!-- phx1api05 @ Mon, 17 Dec 2012 16:36:28 -0700 -->

这是我的代码:

api = pbapi.PbApi(API_KEY, API_SECRET)
api.pb_request.connection.cache = None

# Getting request token
api.reset().login().request().post().load_token_from_response()

# Requesting user permission (you have to login with your account)
webbrowser.open_new_tab(api.login_url)
raw_input("Press Enter when you finished access permission. ")

#Getting oAuth token
#api.reset().login().access().post().load_token_from_response()
print api.reset().login().access().post().response_string

请帮忙。

【问题讨论】:

    标签: python oauth photobucket


    【解决方案1】:

    Photobucket 是一个极其困难的提供程序,因为它们重定向端点的方式。但是我有点惊讶他们自己的包装不起作用。我会推荐rauth,但它不会开箱即用:您必须将签名对象子类化,该对象手动重载要签名的URL,即将其设置为'api.photobucket.com',然后将您的自定义签名对象传递给会话构造函数。这是可行的,但有点混乱。我正在为一个项目工作,但我现在没有可以为您提供的示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-18
      • 2013-04-09
      • 1970-01-01
      • 1970-01-01
      • 2013-07-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多