我试图让site in a dropbox工作主要是想知道如何在appengine上使用dropbox。在
Python: c: \程序文件(x86)\Google\Google_appengine>;python Python 2.7.3(默认值,2012年4月10日,23:31:26)[MSC v.1500 32位(Intel)]on win 32个
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp\_webapp25.py", line 701, in __call__
handler.get(*groups)
File "C:\youiestsiteinadropbox\siteinadropbox\handlers\dropboxhandlers.py", line 38, in new_f
f(self, *args, **kwargs)
File "C:\youiestsiteinadropbox\siteinadropbox\handlers\dropboxhandlers.py", line 65, in get
self.dropbox_auth_callback(self.site)
File "C:\youiestsiteinadropbox\siteinadropbox\handlers\dropboxhandlers.py", line 118, in dropbox_auth_callback
access_token = models.Site.dropbox_auth.obtain_access_token(token, "")
File "C:\youiestsiteinadropbox\dropbox\auth.py", line 177, in obtain_access_token
self.oauth_request.sign_request(self.signature_method_hmac_sha1, self.consumer, token)
File "C:\youiestsiteinadropbox\oauth\oauth.py", line 259, in sign_request
self.build_signature(signature_method, consumer, token))
File "C:\youiestsiteinadropbox\oauth\oauth.py", line 263, in build_signature
return signature_method.build_signature(self, consumer, token)
File "C:\youiestsiteinadropbox\oauth\oauth.py", line 634, in build_signature
hashed = hmac.new(key, raw, sha)
File "C:\Python27\lib\hmac.py", line 133, in new
return HMAC(key, msg, digestmod)
File "C:\Python27\lib\hmac.py", line 72, in __init__
self.outer.update(key.translate(trans_5C))
TypeError: character mapping must return integer, None or unicode
应用程序内最后一次呼叫是:
文件“C:\youiestsiteinadropbox\siteinadropbox\handlers\dropboxhandlers.py,第118行,在dropbox_auth_回调中 访问令牌=models.Site.dropbox_身份验证。获取“访问”令牌(令牌,“”)
无法将此部分转换为unicode。关于如何开始使用appengine上的dropbox有什么想法或其他建议吗?提前谢谢。在
我从未使用过siteinadropbox,但是这个错误的最终原因是最后一个变量中的
key
是一个unicode
对象,而代码期望它是一个str
对象。我知道这不是一个特别有用的信息。在我签出了siteindropbox代码,并查看了
key
值的来源,除非有什么恶作剧,否则只有当您的dropbox.auth.Authenticator
实例的self.consumer.secret
是unicode或当dropbox_auth_callback
中的token.secret
是unicode时,它才会是unicode。我不认为这两种情况是如何发生的。在创建Authenticator
时,您是否碰巧传入了一个自定义的config
dict,还是遵循了使用Authenticator.load_config
的模式,就像siteinadropbox/models/site.py
和test/dbtools.py
中所做的那样?在我改了hmac.py,如果在调用translate之前是unicode,则将key转换为str对象,并且可以工作。在
相关问题 更多 >
编程相关推荐