fix #7 properly handle unicode characters
This commit is contained in:
parent
88e00634e1
commit
ccc6e6ba1c
1 changed files with 6 additions and 0 deletions
|
@ -2,6 +2,7 @@ import oauth2 as oauth
|
|||
import urlparse
|
||||
import urllib
|
||||
import httplib2
|
||||
import types
|
||||
|
||||
|
||||
class OpenPhoto(object):
|
||||
|
@ -37,6 +38,11 @@ class OpenPhoto(object):
|
|||
consumer = oauth.Consumer(self.consumer_key, self.consumer_secret)
|
||||
token = oauth.Token(self.token, self.token_secret)
|
||||
|
||||
# ensure utf-8 encoding for all values.
|
||||
params = dict([(k, v.encode('utf-8')
|
||||
if type(v) is types.UnicodeType else v)
|
||||
for (k, v) in params.items()])
|
||||
|
||||
client = oauth.Client(consumer, token)
|
||||
body = urllib.urlencode(params)
|
||||
headers, content = client.request(url, "POST", body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue