Skip to content

Commit 714de5a

Browse files
committed
Modifying parse_body so local var body is always in scope. intercom#72
1 parent 96b4d8b commit 714de5a

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

intercom/request.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ def send_request_to_path(cls, method, url, auth, params=None):
4343
def parse_body(cls, resp):
4444
try:
4545
body = json.loads(resp.content.decode())
46+
if body.get('type') == 'error.list':
47+
cls.raise_application_errors_on_failure(body, resp.status_code)
48+
return body
4649
except ValueError:
4750
cls.raise_errors_on_failure(resp)
48-
if body.get('type') == 'error.list':
49-
cls.raise_application_errors_on_failure(body, resp.status_code)
50-
return body
5151

5252
@classmethod
5353
def set_rate_limit_details(cls, resp):

tests/integration/issues/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# -*- coding: utf-8 -*-

tests/integration/issues/test_72.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import os
4+
import unittest
5+
from intercom import Intercom
6+
from intercom import User
7+
8+
Intercom.app_id = os.environ.get('INTERCOM_APP_ID')
9+
Intercom.app_api_key = os.environ.get('INTERCOM_APP_API_KEY')
10+
11+
12+
class Issue72Test(unittest.TestCase):
13+
14+
def test(self):
15+
User.create(email='me@example.com')

0 commit comments

Comments
 (0)