Python

August 3rd, 2024suno

Lyrics

from flask import Flask, request, jsonify from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///functions.db' db = SQLAlchemy(app) CORS(app) class Function(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), nullable=False) description = db.Column(db.String(200), nullable=False) language = db.Column(db.String(100), nullable=False) with app.app_context(): db.create_all() @app.route('/api/functions', methods=['GET']) def get_functions(): functions = Function.query.all() results = [ { 'id': func.id, 'name': func.name, 'description': func.description, 'language': func.language } for func in functions ] return jsonify(results) @app.route('/api/functions/search', methods=['GET']) def search_functions(): query = request.args.get('query', '') language = request.args.get('language', '') functions = Function.query.filter( Function.description.ilike(f'%{query}%'), Function.language.ilike(f'%{language}%') ).all() results = [ { 'id': func.id, 'name': func.name, 'description': func.description, 'language': func.language } for func in functions ] return jsonify(results) @app.route('/api/functions', methods=['POST']) def add_function(): data = request.get_json() if 'name' not in data or 'description' not in data or 'language' not in data: return jsonify({'error': 'Bad Request', 'message': 'Missing name or description or language'}), 400 new_function = Function(name=data['name'], description=data['description'], language=data['language']) db.session.add(new_function) db.session.commit() return jsonify({'message': 'Function added'}), 201 @app.route('/api/functions/<int:id>', methods=['DELETE']) def delete_function(id): function = Function.query.get_or_404(id) db.session.delete(function) db.session.commit() return jsonify({'message': 'Function deleted'}) if __name__ == '__main__': app.run(debug=True)

Recommended

Let's Do It
Let's Do It

[heavy dub step grunge metal] [UK metal screamer male vocal]

CHATARA
CHATARA

HARDCORE BROOKLYN RAP

ꜱʜᴀᴋᴇɴ ɴᴏᴛ ꜱᴛɪʀʀᴇᴅ
ꜱʜᴀᴋᴇɴ ɴᴏᴛ ꜱᴛɪʀʀᴇᴅ

dubstep, experimental, vaporwave, retrowave, fast, instrumental

Eternal Warrior's Anthem
Eternal Warrior's Anthem

Epic, Progressive rock, Riff, Male

Need MY Space
Need MY Space

synth, avant-garde, violin, violins, intro violins emotional, deep female voice, emotional, emo,

Electric City
Electric City

deep hard bass minimalistic synthesizer sequences deep tech house

Lost and Found
Lost and Found

Atmospheric Rock, Emo, Dark, Witch house, Heartfelt, Emotional

Fading Echoes
Fading Echoes

solo piano dramatic

Future Love
Future Love

Kpop,alt-pop,samples of music from the 1990s and 2000s,cyber aesthetic,anime like, energetic and romantic

Endless Rain
Endless Rain

soulful melancholic piano-driven

Unsere Liebe
Unsere Liebe

Trance , mixed voice

God of love
God of love

contagious tech house

【18】
【18】

fantasy, 80s, pop, aggressive, energetic, forest, DEEP, moonlight, dark, majolica

Fine and decent gal
Fine and decent gal

melancholic, acoustic, acoustic guitar, chill, deep, bass, pop, classical

如果不愛請放我走
如果不愛請放我走

Cantopop, Ballad, Emotional, Male vocal, Acoustic instruments (Piano, Guitar, Violin, Cello, Drums)

บ้านแสนร่มรื่น
บ้านแสนร่มรื่น

ลูกทุ่ง จังหวะสนุกสนาน

Neon Lights Groove
Neon Lights Groove

female vocalist,rock,funk,energetic,pop,alternative rock,japanese,j-pop