def can_access_api(self):
        """
        :return: True when we can access the REST API
        """
        try:
            version_dict = self.get_version()
        except Exception, e:
            msg = 'An exception was raised when connecting to REST API: "%s"'
            raise APIException(msg % e)
        else:
            """
            This is an example response from the REST API
            {
                "branch": "develop",
                "dirty": "Yes",
                "revision": "f1cae98161 - 24 Jun 2015 16:29",
                "version": "1.7.2"
            }
            """
            if 'version' in version_dict:
                # Yup, this looks like a w3af REST API
                return True

            msg = 'Unexpected HTTP response when connecting to REST API'
            raise APIException(msg)
def can_access_api ( self ) : try : version_dict = self . get_version ( ) except Exception , e : msg = 'An exception was raised when connecting to REST API: "%s"' raise APIException ( msg % e ) else : if 'version' in version_dict : return True msg = 'Unexpected HTTP response when connecting to REST API' raise APIException ( msg )
:return: True when we can access the REST API