smugpy
smugpy copied to clipboard
issue with unicode
Hi Smugpy does not seem to handle unicode well. When i use str it passes the api, but it makes the rest of the code more difficult as i am not working with unicode characters directly. Perhaps you cant accept unicode, or i am doing this wrong...
smugmug.albums_create arg Title=Dürrnberg(<type 'unicode'>), CategoryID=115028007(<type 'int'>)
Traceback (most recent call last):
File "/home/mbarlow/bin/smugsync.py", line 224, in <module>
smugmug.albums_create(Title=local_album_name, CategoryID=category)
File "/usr/local/lib/python2.7/dist-packages/smugpy/__init__.py", line 190, in api_request
oauth = self._get_oauth_request_params(url, all_args, "POST")
File "/usr/local/lib/python2.7/dist-packages/smugpy/__init__.py", line 246, in _get_oauth_request_params
signature = self._oauth_signature(method, url, args)
File "/usr/local/lib/python2.7/dist-packages/smugpy/__init__.py", line 260, in _oauth_signature
for k, v in sorted(parameters.items())))
File "/usr/local/lib/python2.7/dist-packages/smugpy/__init__.py", line 260, in <genexpr>
for k, v in sorted(parameters.items())))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 1: ordinal not in range(128)
I have to write some tests to do some proper tests on unicode. I will do that and see what that shows me. Thanks for the report!