Skip to content

Commit

Permalink
Merge pull request #25 from wchatx/session_initialization
Browse files Browse the repository at this point in the history
Session initialization
  • Loading branch information
wchatx committed Jul 9, 2019
2 parents 38eb9e8 + ea62889 commit 3394add
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions directaccess/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def __init__(self, api_key, retries, backoff_factor, **kwargs):
raise DAAuthException('API KEY is required')

self.session = requests.Session()
self.session.verify = kwargs.pop('verify', True)
self.session.proxies = kwargs.pop('proxies', {})
self.session.headers.update({
'X-API-KEY': self.api_key,
'User-Agent': 'direct-access-py'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import find_packages
from setuptools.command.install import install

VERSION = '1.2.0'
VERSION = '1.2.1'


class VerifyVersionCommand(install):
Expand Down
13 changes: 8 additions & 5 deletions tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@ def test_query():
client_id=DIRECTACCESS_CLIENT_ID,
client_secret=DIRECTACCESS_CLIENT_SECRET,
retries=5,
backoff_factor=1,
backoff_factor=1
)

resp = d2.query('rigs')
query = d2.query('rigs', pagesize=10000)
records = list()
for i, row in enumerate(resp, start=1):
for i, row in enumerate(query, start=1):
records.append(row)

if i % 50 == 0:
assert len(records) == 50
assert records

return


if __name__ == '__main__':
test_query()

0 comments on commit 3394add

Please sign in to comment.