I’m trying to get site in a dropbox working mainly to figure out how to use dropbox on appengine.
the python:
c:\Program Files (x86)\Google\google_appengine>python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (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
The last call made inside the app is:
File “C:\youiestsiteinadropbox\siteinadropbox\handlers\dropboxhandlers.py”, line 118, in dropbox_auth_callback
access_token = models.Site.dropbox_auth.obtain_access_token(token, “”)
Not having much success converting this part to unicode. Any ideas or other pointers on how to get started with dropbox on appengine? Thanks in advance.
I haven’t ever used siteinadropbox, but the end cause of this error is that the
keyvariable from the last is aunicodeobject, when the code is expecting it to be astrobject. Not a particularly helpful message, I know.I checked out the siteinadropbox code and checked to see where that
keyvalue is coming from, and unless there are shenanigans going on somewhere, it will only be unicode when yourdropbox.auth.Authenticatorinstance’sself.consumer.secretis unicode or whentoken.secretfromdropbox_auth_callbackis unicode. I don’t see with a cursory examination how either of those could happen. Did you happen to pass in a customconfigdict when creating yourAuthenticator, or did you follow the pattern of usingAuthenticator.load_config, as is done in thesiteinadropbox/models/site.pyandtest/dbtools.pyexamples?