This project is a Python-based recipe search tool that integrates with the Edamam Recipe API. It allows users to search for recipes based on a specific ingredient and accommodates nut allergy concerns.
- Search recipes by ingredient
- Filter recipes for nut allergies
- Sort recipes by fat content (lowest to highest)
- Save search results to a text file
- Python 3.x
requests
library- Edamam API credentials (app_id and app_key)
-
Clone this repository:
git clone https://github.com/your-username/recipe-search-project.git cd recipe-search-project
-
Install the required library:
pip install requests
-
Obtain Edamam API credentials:
- Visit Edamam Developer Portal
- # and create a new application
- Get your
app_id
andapp_key
-
Update the
app_id
andapp_key
in the script:app_id = "YOUR_APP_ID" app_key = "YOUR_APP_KEY"
-
Run the script:
python recipe_search.py
-
Enter an ingredient when prompted.
-
Specify if you have a nut allergy (Yes/No).
-
The script will display recipes sorted by fat content and save them to
recipe.txt
.
- The script sends a request to the Edamam API with the user's ingredient.
- If the user has a nut allergy, it adds a filter for nut-free recipes.
- The script processes the API response, extracting recipe details.
- Recipes are sorted by fat content and displayed/saved.
The contains_nuts
function provides an additional layer of checking for nut allergens by:
- Scanning ingredient lists for common nut keywords
- Checking health labels and cautions in the API response
Png images in this folder