def authenticate(self, is_global=True):
        """Authenticates against the API server.

        :param is_global: If True, authenticate globally. Local login if False.
        :raise AuthenticationException: Raises if there was an issue with authenticating or logging in.
        :raise MyGeotabException: Raises when an exception occurs on the MyGeotab server.
        :raise TimeoutException: Raises when the request does not respond after some time.
        :return: A Credentials object with a session ID created by the server.
        :rtype: Credentials
        """
        auth_data = dict(database=self.credentials.database, userName=self.credentials.username,
                         password=self.credentials.password)
        auth_data['global'] = is_global
        try:
            result = _query(self._server, 'Authenticate', auth_data, self.timeout,
                            verify_ssl=self._is_verify_ssl)
            if result:
                new_server = result['path']
                server = self.credentials.server
                if new_server != 'ThisServer':
                    server = new_server
                credentials = result['credentials']
                self.credentials = Credentials(credentials['userName'], credentials['sessionId'],
                                               credentials['database'], server)
                return self.credentials
        except MyGeotabException as exception:
            if exception.name == 'InvalidUserException':
                raise AuthenticationException(self.credentials.username,
                                              self.credentials.database,
                                              self.credentials.server)
            raise
def authenticate ( self , is_global = True ) : auth_data = dict ( database = self . credentials . database , userName = self . credentials . username , password = self . credentials . password ) auth_data [ 'global' ] = is_global try : result = _query ( self . _server , 'Authenticate' , auth_data , self . timeout , verify_ssl = self . _is_verify_ssl ) if result : new_server = result [ 'path' ] server = self . credentials . server if new_server != 'ThisServer' : server = new_server credentials = result [ 'credentials' ] self . credentials = Credentials ( credentials [ 'userName' ] , credentials [ 'sessionId' ] , credentials [ 'database' ] , server ) return self . credentials except MyGeotabException as exception : if exception . name == 'InvalidUserException' : raise AuthenticationException ( self . credentials . username , self . credentials . database , self . credentials . server ) raise
Authenticates against the API server.

        :param is_global: If True, authenticate globally. Local login if False.
        :raise AuthenticationException: Raises if there was an issue with authenticating or logging in.
        :raise MyGeotabException: Raises when an exception occurs on the MyGeotab server.
        :raise TimeoutException: Raises when the request does not respond after some time.
        :return: A Credentials object with a session ID created by the server.
        :rtype: Credentials