Skip to content

Commit 5451d91

Browse files
rowedonaldeFederico Delgado
authored andcommitted
Fixed a bug in which request tried to call the string method encode
on ints passed in to the data object
1 parent 393ae40 commit 5451d91

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ox3apiclient/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,12 @@ def request(self, url, method='GET', headers={}, data=None, sign=False,
179179
# Everything needs to be UTF-8 for urlencode and json:
180180
data_utf8 = req.get_data()
181181
for i in data_utf8:
182-
data_utf8[i] = data_utf8[i].encode('utf-8')
182+
# Non-string ints don't have encode and can
183+
# be handled by json.dumps already:
184+
try:
185+
data_utf8[i] = data_utf8[i].encode('utf-8')
186+
except AttributeError:
187+
pass
183188
if send_json:
184189
req.add_data(json.dumps(data_utf8))
185190
else:

0 commit comments

Comments
 (0)