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

بسم الله
بسم الله

deep violin & harp acoustic romantic arabic fusion

Казачья молитва
Казачья молитва

Medieval folk, Viking Chant, War Cry, War Beat, Epic War Drums, Tuvan throat singing, Russian Lyrics

the singing of the strings
the singing of the strings

bolero, balada, drama, funktronica, instrumental guitar solo,

Boy
Boy

Rock song, female voice, electric guitar

rentak cinta
rentak cinta

pop 60s, drum, modern gutir, trumpet

Hazy Daze
Hazy Daze

turkish psych psychedelic groovy

撃鉄を起こせば犬に当たる…
撃鉄を起こせば犬に当たる…

A jazz session featuring jazz piano, rifle shots, and machine gun fire.

Pumpsh
Pumpsh

hyper-jungle, electro

My Tennessee
Title: "Bible and a Rifle"

Verse 1:
Bible and my Rifle
My Tennessee Title: "Bible and a Rifle" Verse 1: Bible and my Rifle

Rock Country, Rough, Outlaw, Southern, upbeat, Rock-infused, Rowdy Country, Male Southern accent voice. Rasp

Europe Rulez
Europe Rulez

Hard rock, synthesyzer, swedish hard rock 1988 Europe band style, The final countdown, hard rock, Joey Tempest, metal

Beyond Sky Fall
Beyond Sky Fall

synth-heavy edm futuristic

Drive Tomorrow
Drive Tomorrow

electronic futuristic upbeat

Пойдём со мной
Пойдём со мной

goth rock, industrial, 1980s, male singer

Simulacrum enigma
Simulacrum enigma

Industrial, Dark Synthwave, Dark Classical, Glitch Hop, Cyberpunk Soundtracks, Female robot voice

Gamby's Twilight Hunt
Gamby's Twilight Hunt

male vocalist,country,country pop,regional music,northern american music,melodic,sentimental,playful,longing,acoustic

Ysesteria's return of the fullest
Ysesteria's return of the fullest

Choir, Opera, female, woman, voice, fantasy, anime, flutes, slight punk, slow, peaceful, vocal, experimental, recorder

Mirror
Mirror

Dark rock, deep male voice, 80 bpm, acoustic guitar, piano, strings, soft drums, percussions

Rescue Me
Rescue Me

Alternative Rock, Emo, Grunge, Post-Hardcore, Edgy male vocal

Faded Memories
Faded Memories

acoustic country melancholic