Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tariq Daouda authored and Tariq Daouda committed Mar 24, 2024
2 parents 5a786eb + bb34d83 commit 71555df
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
* Added getitem for documents at the database level
* Added fill_default() on documents to replace None values by schema defaults
* fill_default() is automatically called on save
=====

2.0.3
=====
* Added support for authentication via client-side certificates

2.0.2
=====
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

0 comments on commit 71555df

Please sign in to comment.