Exemplo n.º 1
0
def delete_key(key):

    if request.method == 'DELETE' or (request.method == 'POST' and request.json['_method'] == 'delete'):
        try:
            response = db.delete_key(key)
        except Exception as e:
            return jsonify(status="error", message=str(e)), 500

        if response:
            return jsonify(status="ok")
        else:
            return jsonify(status="error", message="not found"), 404
Exemplo n.º 2
0
def delete_key(key):

    if request.method == 'DELETE' or (request.method == 'POST'
                                      and request.json['_method'] == 'delete'):
        try:
            response = db.delete_key(key)
        except Exception as e:
            return jsonify(status="error", message=str(e)), 500

        if response:
            return jsonify(status="ok")
        else:
            return jsonify(status="error", message="not found"), 404
Exemplo n.º 3
0
 def delete(self) -> bool:
     """
     Delete an API key.
     """
     return db.delete_key(self.key)
Exemplo n.º 4
0
Arquivo: key.py Projeto: 3IWOH/alerta
 def delete(self):
     """
     Delete an API key.
     """
     return db.delete_key(self.key)