Skip to content

Commit 84b3dce

Browse files
Merge pull request #24 from janrain/topic/type-checking
Topic/type checking
2 parents 6034622 + 4fbe1c8 commit 84b3dce

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

janrain/capture/api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ def api_encode(value):
3232
Returns:
3333
The value encoded for the Janrain API.
3434
"""
35-
if type(value) in (dict, list):
35+
if isinstance(value, (dict, list, tuple)):
3636
return to_json(value).encode('utf-8')
37-
if type(value) == bool:
38-
return str(value).lower().encode('utf-8')
37+
if value is True:
38+
return 'true'
39+
if value is False:
40+
return 'false'
3941
try:
4042
if isinstance(value, basestring):
4143
return value.encode('utf-8')

janrain/capture/test/test_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def setUp(self):
2424
})
2525

2626
def test_api_response_error(self):
27-
with self.assertRaises(ApiResponseError):
27+
with self.assertRaises(HTTPError):
2828
self.api.call('/foobar')
2929

3030
with self.assertRaises(ApiResponseError):

0 commit comments

Comments
 (0)