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

le mariage
le mariage

pop romantique , piano, guitare acoustiques/electrique, synthétiseurs légers, pop, electro, synth, electronic, beat

Whispers of Melody
Whispers of Melody

Breathtaking Ethereal Jazz-Folk Fusion

Through the Portal
Through the Portal

ethereal electronic ambient

Harmonious Bonds
Harmonious Bonds

j-core uk hardcore frenchcore

Tokyo Streets 3
Tokyo Streets 3

progressive anime-influenced electro metalcore 808 cowbell deep bass lo-fi dubstep memphis rap phonk synthwave

Shadows in the Village
Shadows in the Village

electronic mysterious suspenseful

Schwerelos
Schwerelos

hardstyle, hardcore, hardtekk, bass, drops, epic drop, bass drop, epic bass, female vocal

On the Peak
On the Peak

mellow tuvan throat singing traditional

Rulers of the Pitch
Rulers of the Pitch

heavy metal aggressive anthemic

Karanlıkta Yürürken
Karanlıkta Yürürken

karanlık yoğun trap

Bipoler Love
Bipoler Love

70s chill, emotional, soulful, adult contemporary, vaporwave, synth breakdown, sophisticated, deep single male vocal.

Los Mejores de Europa
Los Mejores de Europa

energético pop bailable

Mi Corazón en el Basurero
Mi Corazón en el Basurero

banda with clarinet mexican regional

fāTH
fāTH

Winding, introspective, math rock, guitar lead

Wonderful Love Love More
Wonderful Love Love More

female voice k-pop

Tide of Change
Tide of Change

uplifting pop rhythmic