@@ -83,6 +83,7 @@ def __init__(
8383 username ,
8484 password ,
8585 verify = True ,
86+ cert = None ,
8687 max_conflict_retries = 5 ,
8788 max_retries = 5 ,
8889 single_session = True ,
@@ -96,6 +97,7 @@ def __init__(
9697 self .auth = None
9798 self .pool_maxsize = pool_maxsize
9899 self .verify = verify
100+ self .cert = cert
99101 self .max_retries = max_retries
100102 self .log_requests = log_requests
101103 self .max_conflict_retries = max_conflict_retries
@@ -122,6 +124,8 @@ def _make_session(self):
122124 https = requests .adapters .HTTPAdapter (** kwargs )
123125 session .mount ('http://' , http )
124126 session .mount ('https://' , https )
127+ if self .cert :
128+ session .cert = self .cert
125129
126130 return session
127131
@@ -198,6 +202,7 @@ def __init__(
198202 username = None ,
199203 password = None ,
200204 verify = True ,
205+ cert = None ,
201206 verbose = False ,
202207 statsdClient = None ,
203208 reportFileName = None ,
@@ -241,7 +246,7 @@ def __init__(
241246 self .identifier = None
242247 self .startTime = None
243248 self .session = None
244- self .resetSession (username , password , verify )
249+ self .resetSession (username , password , verify , cert )
245250
246251 self .users = Users (self )
247252
@@ -295,12 +300,14 @@ def create_aikido_session(
295300 self ,
296301 username ,
297302 password ,
298- verify
303+ verify ,
304+ cert
299305 ) -> AikidoSession :
300306 return AikidoSession (
301307 username = username ,
302308 password = password ,
303309 verify = verify ,
310+ cert = cert ,
304311 single_session = True ,
305312 max_conflict_retries = self .max_conflict_retries ,
306313 max_retries = self .max_retries ,
@@ -324,10 +331,12 @@ def create_grequest_session(
324331 verify
325332 )
326333
327- def resetSession (self , username = None , password = None , verify = True ):
334+ def resetSession (self , username = None , password = None , verify = True , cert = None ):
328335 """resets the session"""
329336 self .disconnectSession ()
330337 if self .use_grequests :
338+ if cert is not None :
339+ raise NotImplementedError ('client-side certificates not supported in conjunction with grequests yet' )
331340 self .session = self .create_grequest_session (
332341 username ,
333342 password ,
@@ -337,7 +346,8 @@ def resetSession(self, username=None, password=None, verify=True):
337346 self .session = self .create_aikido_session (
338347 username ,
339348 password ,
340- verify
349+ verify ,
350+ cert
341351 )
342352
343353 def reload (self ):
0 commit comments