我需要使用 Python 的 API 包装器将图像上传到 Photobucket。我可以得到 request_token 和 request_token_secret,但不能得到最终的 access_token 和 access_token_secret。相反,我收到以下错误消息:
pbapi.error.PbApiError: (): Token 和 Token Secret 没有响应
我得到的响应如下:
<?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
请帮忙。