Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2.0.3
=====
* Added support for authentication via client-side certificates

2.0.2
=====
* Fixed contains functions
Expand Down
18 changes: 14 additions & 4 deletions pyArango/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __init__(
username,
password,
verify=True,
cert=None,
max_conflict_retries=5,
max_retries=5,
single_session=True,
Expand All @@ -96,6 +97,7 @@ def __init__(
self.auth = None
self.pool_maxsize = pool_maxsize
self.verify = verify
self.cert = cert
self.max_retries = max_retries
self.log_requests = log_requests
self.max_conflict_retries = max_conflict_retries
Expand All @@ -122,6 +124,8 @@ def _make_session(self):
https = requests.adapters.HTTPAdapter(**kwargs)
session.mount('http://', http)
session.mount('https://', https)
if self.cert:
session.cert = self.cert

return session

Expand Down Expand Up @@ -198,6 +202,7 @@ def __init__(
username=None,
password=None,
verify=True,
cert=None,
verbose=False,
statsdClient=None,
reportFileName=None,
Expand Down Expand Up @@ -241,7 +246,7 @@ def __init__(
self.identifier = None
self.startTime = None
self.session = None
self.resetSession(username, password, verify)
self.resetSession(username, password, verify, cert)

self.users = Users(self)

Expand Down Expand Up @@ -295,12 +300,14 @@ def create_aikido_session(
self,
username,
password,
verify
verify,
cert
) -> AikidoSession:
return AikidoSession(
username=username,
password=password,
verify=verify,
cert=cert,
single_session=True,
max_conflict_retries=self.max_conflict_retries,
max_retries=self.max_retries,
Expand All @@ -324,10 +331,12 @@ def create_grequest_session(
verify
)

def resetSession(self, username=None, password=None, verify=True):
def resetSession(self, username=None, password=None, verify=True, cert=None):
"""resets the session"""
self.disconnectSession()
if self.use_grequests:
if cert is not None:
raise NotImplementedError('client-side certificates not supported in conjunction with grequests yet')
self.session = self.create_grequest_session(
username,
password,
Expand All @@ -337,7 +346,8 @@ def resetSession(self, username=None, password=None, verify=True):
self.session = self.create_aikido_session(
username,
password,
verify
verify,
cert
)

def reload(self):
Expand Down