jnpr/space/rest.py
def login(self, required_node=None):
        """Logs into Space and creates a session (connection) that is
        maintained. All API calls will use this session and will use the
        JSESSIONID, JSESSIONIDSSO cookies - they will not be individually
        authenticated.

        :param str required_node: This is used to specify the name of the Junos
            Space node in the cluster on which the session should be
            established. It is ``None`` by default.
        """
        with self._lock:
            from jnpr.space import connection
            for i in range(10):
                if self.space_user:
                    self._connection = connection.Connection(self.space_url,
                                                             self.space_user,
                                                             self.space_passwd)
                else:
                    self._connection = connection.Connection(self.space_url,
                                                             cert=self.cert)
                if required_node is not None:
                    sid = self._connection.get_session().cookies['JSESSIONID']
                    end = sid.rindex(':')
                    start = sid.rindex('.') + 1
                    node_name = sid[start:end]
                    if required_node == node_name:
                        self._logger.debug("Try %d: Got session on %s",
                                           i, required_node)
                        return
                    else:
                        self._logger.debug("Try %d: Got session on %s instead"\
                                           " of %s",
                                           i, node_name, required_node)
                        self.logout()
                else:
                    return

            raise Exception('Unable to get a session on %s in 10 attempts' %
                            required_node)
Logs into Space and creates a session (connection) that is
        maintained. All API calls will use this session and will use the
        JSESSIONID, JSESSIONIDSSO cookies - they will not be individually
        authenticated.

        :param str required_node: This is used to specify the name of the Junos
            Space node in the cluster on which the session should be
            established. It is ``None`` by default.
        
Logs into Space and creates a session (connection) that is
maintained. All API calls will use this session and will use the
JSESSIONID, JSESSIONIDSSO cookies - they will not be individually
authenticated.
Logs into Space and creates a session ( connection ) that is maintained . All API calls will use this session and will use the JSESSIONID JSESSIONIDSSO cookies - they will not be individually authenticated .
def login(self, required_node=None):
        with self._lock:
            from jnpr.space import connection
            for i in range(10):
                if self.space_user:
                    self._connection = connection.Connection(self.space_url,
                                                             self.space_user,
                                                             self.space_passwd)
                else:
                    self._connection = connection.Connection(self.space_url,
                                                             cert=self.cert)
                if required_node is not None:
                    sid = self._connection.get_session().cookies['JSESSIONID']
                    end = sid.rindex(':')
                    start = sid.rindex('.') + 1
                    node_name = sid[start:end]
                    if required_node == node_name:
                        self._logger.debug("Try %d: Got session on %s",
                                           i, required_node)
                        return
                    else:
                        self._logger.debug("Try %d: Got session on %s instead"\
                                           " of %s",
                                           i, node_name, required_node)
                        self.logout()
                else:
                    return
            raise Exception('Unable to get a session on %s in 10 attempts' %
                            required_node)
def login ( self , required_node = None ) : with self . _lock : from jnpr . space import connection for i in range ( 10 ) : if self . space_user : self . _connection = connection . Connection ( self . space_url , self . space_user , self . space_passwd ) else : self . _connection = connection . Connection ( self . space_url , cert = self . cert ) if required_node is not None : sid = self . _connection . get_session ( ) . cookies [ 'JSESSIONID' ] end = sid . rindex ( ':' ) start = sid . rindex ( '.' ) + 1 node_name = sid [ start : end ] if required_node == node_name : self . _logger . debug ( "Try %d: Got session on %s" , i , required_node ) return else : self . _logger . debug ( "Try %d: Got session on %s instead" " of %s" , i , node_name , required_node ) self . logout ( ) else : return raise Exception ( 'Unable to get a session on %s in 10 attempts' % required_node )
Logs into Space and creates a session (connection) that is
maintained.
Logs into Space and creates a session ( connection ) that is maintained .
"""Logs into Space and creates a session (connection) that is
        maintained. All API calls will use this session and will use the
        JSESSIONID, JSESSIONIDSSO cookies - they will not be individually
        authenticated.

        :param str required_node: This is used to specify the name of the Junos
            Space node in the cluster on which the session should be
            established. It is ``None`` by default.
        """
self
required_node
This is used to specify the name of the Junos
Space node in the cluster on which the session should be
established. It is ``None`` by default.
This is used to specify the name of the Junos Space node in the cluster on which the session should be established . It is ` ` None ` ` by default .