Skip to content

Commit 469d06f

Browse files
Update client.py
1 parent 5aebf5d commit 469d06f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

interfax/client.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class InterFAX(object):
2525
USER_AGENT = 'InterFAX Python {0}'.format(__version__)
2626
DOMAIN = 'rest.interfax.net'
2727

28-
def __init__(self, username=None, password=None, timeout=None):
28+
def __init__(self, username=None, password=None):
2929
username = username or environ.get('INTERFAX_USERNAME', None)
3030
password = password or environ.get('INTERFAX_PASSWORD', None)
3131

@@ -39,7 +39,7 @@ def __init__(self, username=None, password=None, timeout=None):
3939

4040
self.username = username
4141
self.password = password
42-
self.timeout = timeout
42+
print("Authentication: done")
4343

4444
@cached_property
4545
def inbound(self):
@@ -83,7 +83,6 @@ def delete(self, path, **kwargs):
8383

8484
def _request(self, method, url, **kwargs):
8585
"""Make a HTTP request."""
86-
kwargs.setdefault('timeout', self.timeout)
8786
kwargs.setdefault('headers', {})
8887
kwargs['headers']['User-Agent'] = self.USER_AGENT
8988
kwargs['auth'] = (self.username, self.password)
@@ -108,12 +107,17 @@ def _parse_response(self, response):
108107
"""Parse a response object and return the url, json, or binary
109108
content."""
110109
if response.ok:
110+
print(response)
111111
if 'location' in response.headers:
112112
return response.headers['location']
113113
else:
114114
try:
115-
return response.json()
115+
r = response.json()
116+
return r
116117
except:
117-
return response.content
118+
r = response.content
119+
return r
118120
else:
121+
print(response)
122+
print('FAILED!')
119123
response.raise_for_status()

0 commit comments

Comments
 (0)