8000 Merge pull request #116 from jvankoten/master · Web5design/twilio-python@2ae0797 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 2ae0797

Browse files
author
Kevin Burke
committed
Merge pull request twilio#116 from jvankoten/master
Fixing 'data should be either a binary or a string'
2 parents d15cf55 + 660fd16 commit 2ae0797

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

twilio/rest/resources/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from six import text_type, iteritems, binary_type
2+
from six import integer_types, string_types, binary_type, iteritems
33
from twilio.compat import urlparse
44
from twilio.compat import urlencode
55

@@ -40,12 +40,12 @@ def make_request(method, url, params=None, data=None, headers=None,
4040
udata = {}
4141
for k, v in iteritems(data):
4242
key = k.encode('utf-8')
43-
if isinstance(v, text_type):
44-
udata[key] = v.encode('utf-8')
45-
elif isinstance(v, binary_type):
43+
if isinstance(v, (integer_types, binary_type)):
4644
udata[key] = v
45+
elif isinstance(v, string_types):
46+
udata[key] = v.encode('utf-8')
4747
else:
48-
raise ValueError('data should be either a binary or a string')
48+
raise ValueError('data should be iinteger or binary or string')
4949
data = urlencode(udata)
5050

5151
if params is not None:

0 commit comments

Comments
 (0)
0