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

The Knight Who Was Brave
The Knight Who Was Brave

Renaissance Metal, Fantasy Metal

Der transzendentalen Ästhetik
Der transzendentalen Ästhetik

transcendental melody driven funky fusion psytrance disco punk

 I'm always happy for you #여러분을_위해_늘_기뻐
I'm always happy for you #여러분을_위해_늘_기뻐

ballads, acoustic guitar, piano, drum, organ, trumpet, flute, bass, orchestra, chorus, chorus

Breaking Point
Breaking Point

steampunk theatrical Russian musical quirky

Cosmic Charmer
Cosmic Charmer

male vocalist,pop,jazz,melodic,lush,bittersweet,sentimental,passionate,love,mellow,introspective,romantic,longing,lonely,soothing,melancholic

Who am I?
Who am I?

punta, glitch, wave, emo, ambient, trance, new age, mizrahi, minimal synth, oud, handpan, chillwave, bubblegum bass

Сергей Калюжный
Сергей Калюжный

энергично диско весело

Empty Promises (exstended)
Empty Promises (exstended)

symphonic metal, angelic female vocal

In the depths of the Night (Hands up Remix)
In the depths of the Night (Hands up Remix)

Vocal Trance, Violins, female voice, epic melody

Pop Goes the Everything
Pop Goes the Everything

Children's Spoken Word

Neon Heart
Neon Heart

smooth soulful r&b

Forever to Abide
Forever to Abide

melodic techno

Of scarecrows and carrots
Of scarecrows and carrots

Mournful husky voice (Steampunk)

You Are the Battle
You Are the Battle

Metalcore, Melodic metalcore, thrash metal, hard rock

Ruhani Tamanna
Ruhani Tamanna

indie, soulful, indie pop, melodic, acoustic guitar, guitar, flute, synth, synthwave, drum, piano

Midnight Adventures
Midnight Adventures

bouncy dancepop

Dame Una Oportunidad
Dame Una Oportunidad

Male Voice, Classic Reggaeton, BPM: 90-95, Key: A minor, Perc: reggaeton, Bass: sub bass, Melodies: pads, guitars,

Astarion's Requiem
Astarion's Requiem

Create an epic, orchestral piece with male singer and choir, inspired by Baldur's Gate 3's magical, adventurous themes