Skip to content

Commit 9c90abd

Browse files
committed
data is converted from unicode to UTF-8 for urlencode
1 parent f9c9043 commit 9c90abd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ox3apiclient/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ def request(self, url, method='GET', headers={}, data=None, sign=False):
160160

161161
# Stringify data.
162162
if data:
163-
req.add_data(urllib.urlencode(req.get_data()))
163+
# Everything needs to be UTF-8 for urlencode:
164+
data_utf8 = req.get_data()
165+
for i in data_utf8:
166+
data_utf8[i] = data_utf8[i].encode('utf-8')
167+
req.add_data(urllib.urlencode(data_utf8))
164168

165169
# In 2.4 and 2.5, urllib2 throws errors for all non 200 status codes.
166170
# The OpenX API uses 201 create responses and 204 for delete respones.

0 commit comments

Comments
 (0)