This Python script allows users to fetch and display recipe details based on a main ingredient using the Spoonacular API. The recipes are presented in a beautifully formatted table using the rich library for enhanced console output.
- Fetches recipes based on a main ingredient entered by the user.
- Allows users to specify the number of recipes to display.
- Displays detailed recipe information including:
- Recipe title
- Cuisines
- Dish types
- Preparation time
- Serving size
- Gluten-free status
- Health score
- Stylish, readable output using
rich.table
with custom styling and formatting.
- Python 3.6 or later
- An active API key from Spoonacular API
-
Clone this repository or copy the script.
-
Install the required libraries:
pip install requests rich
-
Update the
API_KEY
variable in the script with your Spoonacular API key. -
Run the script:
python recipe_finder.py
-
Follow the prompts:
- Enter the main ingredient (e.g., Chicken, Pasta).
- Specify the number of recipes to fetch.
Enter the main Ingredient of the recipe (Ex: Chicken, Pasta etc.): chicken
Enter the number of recipes you would like to view: 15
Enter the main Ingredient of the recipe (Ex: Chicken, Pasta etc.): pasta
Enter the number of recipes you would like to view: 10
- Ensure the API key is valid; otherwise, the script will not retrieve data.
- The script uses rich to enhance the terminal display; ensure your terminal supports rich formatting.