def service_info(): secret = request.form.get('secret', '') or request.args.get('secret', '') service_ = request.form.get('service', '') or request.args.get('service', '') if service_: if not is_service(service_): return jsonify(Error.INVALID_SERVICE) srv = Service.query.filter_by(public=service_).first() if not srv: return jsonify(Error.SERVICE_NOTFOUND) return jsonify({"service": srv.as_dict()}) if secret: if not is_secret(secret): return jsonify(Error.INVALID_SECRET) srv = Service.query.filter_by(secret=secret).first() if not srv: return jsonify(Error.SERVICE_NOTFOUND) return jsonify({"service": srv.as_dict()}) return jsonify(Error.ARGUMENT_MISSING('service'))
def service_info(): secret = request.form.get('secret', '') or request.args.get('secret', '') service_ = request.form.get('service', '') or request.args.get( 'service', '') if service_: if not is_service(service_): return Error.INVALID_SERVICE srv = Service.query.filter_by(public=service_).first() if not srv: return Error.SERVICE_NOTFOUND return jsonify({"service": srv.as_dict()}) if secret: if not is_secret(secret): return Error.INVALID_SECRET srv = Service.query.filter_by(secret=secret).first() if not srv: return Error.SERVICE_NOTFOUND return jsonify({"service": srv.as_dict()}) return Error.ARGUMENT_MISSING('service')