Posts

Showing posts from January, 2025

sample coding

app.py from flask import Flask, request, jsonify, session from flask_cors import CORS import pymysql   # MySQL library import requests from werkzeug.security import generate_password_hash, check_password_hash from retrying import retry import requests app = Flask( __name__ ) app.secret_key = '2576fa35bdb55ddfd7476f752939fa7e' CORS(app) # Database Configuration (Using pymysql) db = pymysql.connect(     host = "localhost" ,     user = "root" ,   # Replace with your MySQL username     password = "" ,   # Replace with your MySQL password     database = "recipe_finder"   # Ensure the database exists ) SPOONACULAR_API_KEY = "4cf45fa4ab174fb5bcd586e17b02a653"   # Replace with your real API key @app.route ( '/' , methods = [ 'GET' ]) def home ():     return jsonify({ "message" : "Welcome to the Recipe Finder API. Use the /find-recipes endpoint to search for recipes." }) @app.route (...