我遇到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