Skip to content

Commit a83948f

Browse files
authored
Merge pull request #14 from usabilla/reuse-connections
Reuse connections when making API calls
2 parents 77f25ad + 8a80f77 commit a83948f

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ Changelog
33

44
Here you find a full list of changes.
55

6+
Version 2.0.1
7+
-------------
8+
9+
- Reuse HTTP connections between requests
10+
611
Version 2.0.0
712
-------------
813

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
except ImportError:
44
from distutils.core import setup
55

6-
VERSION = '2.0.0'
6+
VERSION = '2.0.1'
77

88
setup(
99
name='usabilla-api',

usabilla.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ class APIClient(object):
127127
host = 'data.usabilla.com'
128128
host_protocol = 'https://'
129129

130+
session = requests.Session()
131+
130132
def __init__(self, client_key, secret_key):
131133
"""Initialize an APIClient object."""
132134
self.query_parameters = ''
@@ -237,7 +239,7 @@ def send_signed_request(self, scope):
237239

238240
# Send the request.
239241
request_url = self.host + scope + '?' + canonical_querystring
240-
r = requests.get(self.host_protocol + request_url, headers=headers)
242+
r = self.session.get(self.host_protocol + request_url, headers=headers)
241243
r.raise_for_status()
242244

243245
return r.json()

0 commit comments

Comments
 (0)