@@ -100,18 +100,23 @@ def set_connection(self, url):
100100 raise ValueError ("Expecting url format: bolt://user:password@localhost:7687"
101101 " got {0}" .format (url ))
102102
103- self .driver = GraphDatabase .driver (u .scheme + '://' + hostname ,
104- auth = basic_auth (username , password ),
105- connection_acquisition_timeout = config .CONNECTION_ACQUISITION_TIMEOUT ,
106- connection_timeout = config .CONNECTION_TIMEOUT ,
107- encrypted = config .ENCRYPTED ,
108- keep_alive = config .KEEP_ALIVE ,
109- max_connection_lifetime = config .MAX_CONNECTION_LIFETIME ,
110- max_connection_pool_size = config .MAX_CONNECTION_POOL_SIZE ,
111- max_transaction_retry_time = config .MAX_TRANSACTION_RETRY_TIME ,
112- resolver = config .RESOLVER ,
113- trust = config .TRUST ,
114- user_agent = config .USER_AGENT )
103+ options = dict (
104+ auth = basic_auth (username , password ),
105+ connection_acquisition_timeout = config .CONNECTION_ACQUISITION_TIMEOUT ,
106+ connection_timeout = config .CONNECTION_TIMEOUT ,
107+ keep_alive = config .KEEP_ALIVE ,
108+ max_connection_lifetime = config .MAX_CONNECTION_LIFETIME ,
109+ max_connection_pool_size = config .MAX_CONNECTION_POOL_SIZE ,
110+ max_transaction_retry_time = config .MAX_TRANSACTION_RETRY_TIME ,
111+ resolver = config .RESOLVER ,
112+ user_agent = config .USER_AGENT
113+ )
114+
115+ if "+s" not in u .scheme :
116+ options ['encrypted' ] = config .ENCRYPTED
117+ options ['trust' ] = config .TRUST
118+
119+ self .driver = GraphDatabase .driver (u .scheme + '://' + hostname , ** options )
115120 self .url = url
116121 self ._pid = os .getpid ()
117122 self ._active_transaction = None
0 commit comments