def close(self, soft=False): """ Close a connection :param soft: Softly close the connection - do not actually close the socket (default: False) :type soft: bool """ # close the session, unless it is associated with a pool if not self.pool_session: self._conn.send_message( messages.SessionRequest( session_key=self._session_key, graph_name=self.graph_name, kill_session=True ) ) response = self._conn.get_response() self._session_key = None if isinstance(response, ErrorResponse): response.raise_exception() if not soft: self._opened = False self._in_transaction = False
def _open_session(self): """ Creates a session with rexster and creates the graph object """ self._conn.send_message( messages.SessionRequest(username=self.username, password=self.password, graph_name=self.graph_name)) response = self._conn.get_response() if isinstance(response, ErrorResponse): response.raise_exception() self._session_key = response.session_key
def close(self): self._conn.send_message( messages.SessionRequest( session_key=self._session_key, graph_name=self.graph_name, kill_session=True ) ) response = self._conn.get_response() if isinstance(response, ErrorResponse): raise RexProConnectionException(response.message)
def _open_session(self): """ Creates a session with rexster and creates the graph object """ self._conn.send_message( messages.SessionRequest( username=self.username, password=self.password, graph_name=self.graph_name ) ) response = self._conn.get_response() if isinstance(response, ErrorResponse): raise RexProConnectionException(response.message) self._session_key = response.session_key self.graph_features = self.execute('g.getFeatures().toMap()')