def check_module(): # if request.method != 'GET': # return jsonify(code=405, error='Method not allowed') name = request.args.get('name', '') if name == '': return jsonify(code=502, error='No module name in request') conn = mysql.connect() cursor = conn.cursor() cursor.execute("SELECT version FROM Module WHERE name=%s", (name,)) data = cursor.fetchall() if data: # вернет первую найденную версию return jsonify(code=200, name=name, exists=True, version=data[0][0]) else: return jsonify(code=200, name=name, exists=False)