我遇到AppEngine和Context.IO API非常奇怪的問題。AppEngine,python-oauth2和Context.IO;消費者密鑰未與請求一起發送
我正在使用contextIO2庫,它使用python-oauth2。
當我通過終端試用庫(contextIO2)時,我沒有遇到任何問題(至少現在還沒有,但是我已經在幾天內嘗試了幾次而沒有問題)。
但在AppEngine上運行的代碼的時候,我有時得到401 Authorization Invalid consumer key
錯誤。我不確定是什麼原因造成的,因爲一分鐘內請求沒有問題,那麼當我再次嘗試請求時,我得到401
,過了一段時間就會好起來,然後又不好,等等。
我通過電子郵件發送了Context.IO支持,他說當他嘗試我的應用程序的url並得到錯誤時,「oauth_consumer_key似乎沒有正確傳輸」。什麼可能導致這個? AppEngine搞砸了請求? pythoan-oauth2錯誤? contextIO2錯誤?
這裏是我的處理程序的代碼之一:
class ReceiveConnectTokenHandler(webapp2.RequestHandler):
def get(self):
contextio_token = self.request.get('contextio_token')
cio = ContextIO(API_KEY, API_SECRET)
# get token's associated email
try:
token = cio.get_connect_token(contextio_token)
except RequestError, e:
if e.status_code == 404:
self.response.write(
'Token %s not found. ' % contextio_token)
return
raise e
account = token.account
if not account or not account.email_addresses:
self.response.write(
'Token %s has no email associated with it yet.' % contextio_token)
return
email = account.email_addresses[0]
# clear email's memcache
memcache.delete_multi(['accounts', 'no_account'], namespace=email)
self.response.write(
'''%s is now connected with Context.IO. Please verify in the
gadget that you have granted access. You can close this window.''' % email
)
這只是對https://api.context.io/2.0/connect_tokens/{{token}}
這是contextIO2庫中的一個bug。我如何關閉一個主題? – john2x
你能回答一個錯誤報告/修復嗎?這可能有助於其他人。 – Greg