@@ -27,13 +27,17 @@ class AikidoSession(object) :
2727 """
2828
2929 class Holder (object ) :
30- def __init__ (self , fct , auth ) :
30+ def __init__ (self , fct , auth , verify = True ) :
3131 self .fct = fct
3232 self .auth = auth
33+ if verify != None :
34+ self .verify = verify
3335
3436 def __call__ (self , * args , ** kwargs ) :
3537 if self .auth :
3638 kwargs ["auth" ] = self .auth
39+ if self .verify != True :
40+ kwargs ["verify" ] = self .verify
3741
3842 try :
3943 ret = self .fct (* args , ** kwargs )
@@ -49,12 +53,13 @@ def __call__(self, *args, **kwargs) :
4953 ret .json = JsonHook (ret )
5054 return ret
5155
52- def __init__ (self , username , password ) :
56+ def __init__ (self , username , password , verify = True ) :
5357 if username :
5458 self .auth = (username , password )
5559 else :
5660 self .auth = None
5761
62+ self .verify = verify
5863 self .session = requests .Session ()
5964 self .log = {}
6065 self .log ["nb_request" ] = 0
@@ -68,14 +73,15 @@ def __getattr__(self, k) :
6873
6974 holdClass = object .__getattribute__ (self , "Holder" )
7075 auth = object .__getattribute__ (self , "auth" )
76+ verify = object .__getattribute__ (self , "verify" )
7177 log = object .__getattribute__ (self , "log" )
7278 log ["nb_request" ] += 1
7379 try :
7480 log ["requests" ][reqFct .__name__ ] += 1
7581 except :
7682 log ["requests" ][reqFct .__name__ ] = 1
7783
78- return holdClass (reqFct , auth )
84+ return holdClass (reqFct , auth , verify )
7985
8086 def disconnect (self ) :
8187 try :
@@ -85,7 +91,7 @@ def disconnect(self) :
8591
8692class Connection (object ) :
8793 """This is the entry point in pyArango and directly handles databases."""
88- def __init__ (self , arangoURL = 'http://127.0.0.1:8529' , username = None , password = None , verbose = False , statsdClient = None , reportFileName = None ) :
94+ def __init__ (self , arangoURL = 'http://127.0.0.1:8529' , username = None , password = None , verify = True , verbose = False , statsdClient = None , reportFileName = None ) :
8995 self .databases = {}
9096 self .verbose = verbose
9197 if arangoURL [- 1 ] == "/" :
@@ -98,7 +104,7 @@ def __init__(self, arangoURL = 'http://127.0.0.1:8529', username = None, passwor
98104 self .identifier = None
99105 self .startTime = None
100106 self .session = None
101- self .resetSession (username , password )
107+ self .resetSession (username , password , verify )
102108
103109 self .URL = '%s/_api' % self .arangoURL
104110 if not self .session .auth :
@@ -120,10 +126,10 @@ def disconnectSession(self) :
120126 if self .session :
121127 self .session .disconnect ()
122128
123- def resetSession (self , username = None , password = None ) :
129+ def resetSession (self , username = None , password = None , verify = True ) :
124130 """resets the session"""
125131 self .disconnectSession ()
126- self .session = AikidoSession (username , password )
132+ self .session = AikidoSession (username , password , verify )
127133
128134 def reload (self ) :
129135 """Reloads the database list.
@@ -145,7 +151,7 @@ def reload(self) :
145151 def createDatabase (self , name , ** dbArgs ) :
146152 "use dbArgs for arguments other than name. for a full list of arguments please have a look at arangoDB's doc"
147153 dbArgs ['name' ] = name
148- payload = json .dumps (dbArgs )
154+ payload = json .dumps (dbArgs , default = str )
149155 url = self .URL + "/database"
150156 r = self .session .post (url , data = payload )
151157 data = r .json ()
0 commit comments