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

Neon Sign
Neon Sign

speed,rap, hip hop

消えた夏の記憶
消えた夏の記憶

female vocalist,contemporary folk,folk,singer-songwriter,melancholic,peaceful,piano,japanese

Mermaid Love
Mermaid Love

quirky j-pop

Soho tuna
Soho tuna

beat rock, ancient wizard magic, tuna rock, rat noises, sheep noises, hard rock

Ocean View Hospital Saving Lives
Ocean View Hospital Saving Lives

DRILL, uk drill, dark, perfect quality, MALE harmonies, FEMALE Vocal, electric piano, synthwave, bass, drum, rap

Fat Man Ramon
Fat Man Ramon

50s doo-wop

MenT hvězda internetu
MenT hvězda internetu

Violins ballads rap, male voice, rock, metal

Stand Tall
Stand Tall

boogie upbeat rhythm piano blues syncopation

Unity Amidst the Storm.
Unity Amidst the Storm.

Russian / Ukrainian Rap Song, Studio-Quality-Audio, Dynamic/Versatile-Flow, Dark-Gritty-Tone, Real, Drill. UK.

when it all goes wrong
when it all goes wrong

Catchy intro. Song with Ambients Parts, Female Voice emo kids singing,

Cyber Savior
Cyber Savior

Una rap sobre neo de matrix,electronic,synthesizer,hip hop,

Fußball
Fußball

Epic german Soccer-Fan-Partysong, male vocals, Fans

Bear Witness
Bear Witness

heavy techno, anime style hype-up speech, gym music, motivation, strong bassline, hardcore techno beat, epic beat drop

Galaxy Dream
Galaxy Dream

happy upbeat, female vocals with heavy bass

September's Sigh
September's Sigh

instrumental,instrumental,instrumental,jazz,cool jazz,soul jazz,smooth jazz

In the Zone
In the Zone

chilled indie acoustic

BONBON GIRLS
BONBON GIRLS

KPOP Girl Group, Female Voice., disco, pop, dance, 90s, beat, happy