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)

Empfohlen

Зубы почистить
Зубы почистить

эмо-панк-рок

Stand Together (Witch House Trance)
Stand Together (Witch House Trance)

Female Vocal, Dark Witch House Trance, Melancholy, Somber Goth Haunted, Hypnotic Bass, Harpsichord

Echos of Integrity
Echos of Integrity

heavy metal, rock, bass, guitar, pop, rap, electro, beat

Echoes of Us
Echoes of Us

Man, Pop, Vibrant, Rap, Deep voice, Beat Switch, Male Singer, Quinn XCIII, Talking Verse, Deep Voice Verse

男孩
男孩

old school rap, emotion, female voice, guitar

Digital Passion
Digital Passion

Synth-pop, Retro, catchy, beat, indie pop, 80s, soul, grunge, smooth, uplifting, aggressive, r&b, jazz, rock, upbeat

nEURAL oSCILLATIONS (rMX1)
nEURAL oSCILLATIONS (rMX1)

electro-wing, electro-jazz, mutation funk, danceable, pop, futuristic, uptempo, boomtrap, bounce drop, beat, epic

ブランコのある丘
ブランコのある丘

lofi.citypop Mellow.R&B. painful.sad.slow.cute voice, piano, chill

Vitória No DiferLab
Vitória No DiferLab

pop anthemic uplifting

Girls Life
Girls Life

Jazz Funk

Home
Home

Electronic Dance Music (EDM), Classical Fusion, Dubstep, Cinematic Music, Modern Violin

Not just a Pretty Face
Not just a Pretty Face

Upbeat and pop. Moderately fast. Well pronounced words.

#9
#9

Electronics

trap
trap

the female voice, rap, trap, beat

Мир по месту жительства
Мир по месту жительства

psychedelic, pop, beat, bass, drum, rap, trap, drum and bass, emo

Sombras del ayer
Sombras del ayer

suave bolero romántico melancólico

Solare: Der Grind zur Spitze
Solare: Der Grind zur Spitze

psychedelic, rock, hard rock, rap, battle rap

Zindagi Ek Kahani
Zindagi Ek Kahani

Bollywood Song, 90s, guitar, flute