コード例 #1
0
    def delete(self, params, del_id):

        del_str = '{}{}'.format(params, del_id)
        resp_ok, resp_status, resp_data = self.__request('DELETE', del_str)
        if resp_ok and resp_status == 204:
            return True
        else:
            raise exceptions.DeleteException(resp_data)
コード例 #2
0
    def delete(self, params, del_id):

        del_str = '{}{}'.format(params, del_id)
        resp_ok, resp_status, resp_data = self.__request('DELETE', del_str)
        if resp_ok and resp_status == 204:
            return True

        if resp_status == 404:
            raise exceptions.NotFoundException("Unable to found object with id {}".format(del_id), from_con=True)

        raise exceptions.DeleteException(resp_data)
コード例 #3
0
ファイル: connection.py プロジェクト: Mosibi/python-netbox
    def delete(self, params, del_id):
        if self.auth:
            raise exceptions.AuthException(
                'With basic authentication the API is not writable')
        del_str = '{}{}'.format(params, del_id)
        resp_ok, resp_status, resp_data = self.__request('DELETE', del_str)

        if resp_ok and resp_status == 204:
            return True
        else:
            raise exceptions.DeleteException(resp_data)