Example #1
0
    def create_session(self, session_id=None):
        """
        Create a session.

        :param int session_id: id for session, default is None and one will be created for you
        :return: response with created session id
        :rtype: core_pb2.CreateSessionResponse
        """
        request = core_pb2.CreateSessionRequest(session_id=session_id)
        return self.stub.CreateSession(request)
Example #2
0
    def create_session(self, session_id: int = None) -> wrappers.Session:
        """
        Create a session.

        :param session_id: id for session, default is None and one will be created
            for you
        :return: session id
        """
        request = core_pb2.CreateSessionRequest(session_id=session_id)
        response = self.stub.CreateSession(request)
        return wrappers.Session.from_proto(response.session)