📅  最后修改于: 2023-12-03 15:01:05.953000             🧑  作者: Mango
Hackereat is a Python package for food enthusiasts and programmers to find recipes and get cooking tips.
To install Hackereat, simply use pip:
pip install hackereat
To search for recipes, first import the HackereatClient
class and create an instance of it:
from hackereat import HackereatClient
client = HackereatClient()
You can then search for recipes using the search_recipes
method, specifying the query and optionally the number of results to return:
recipes = client.search_recipes(query='spaghetti carbonara', num_results=5)
This will return a list of HackereatRecipe
objects, each representing a recipe that matches the query.
Each HackereatRecipe
object contains a variety of information about the recipe, such as its title, ingredients, and cooking time. You can access this information using the following attributes:
title
: Title of the recipe url
: URL of the recipe image_url
: URL of the recipe image ingredients
: List of ingredients cook_time
: Cooking time source
: Recipe source (e.g. Food Network, Allrecipes) For example, to print the title and ingredients of the first recipe in the list, you can use:
recipe = recipes[0]
print(recipe.title)
print(recipe.ingredients)
Hackereat also provides cooking tips and tricks. To get a random cooking tip, simply call the get_cooking_tip
method:
tip = client.get_cooking_tip()
print(tip)
With Hackereat, you can easily search for recipes and get cooking tips, all within your Python environment. Give it a try and impress your friends and family with your culinary skills!
Markdown output:
# Hackereat - Python
Hackereat is a Python package for food enthusiasts and programmers to find recipes and get cooking tips.
## Installation
To install Hackereat, simply use pip:
```python
pip install hackereat
To search for recipes, first import the HackereatClient
class and create an instance of it:
from hackereat import HackereatClient
client = HackereatClient()
You can then search for recipes using the search_recipes
method, specifying the query and optionally the number of results to return:
recipes = client.search_recipes(query='spaghetti carbonara', num_results=5)
This will return a list of HackereatRecipe
objects, each representing a recipe that matches the query.
Each HackereatRecipe
object contains a variety of information about the recipe, such as its title, ingredients, and cooking time. You can access this information using the following attributes:
title
: Title of the recipe url
: URL of the recipe image_url
: URL of the recipe image ingredients
: List of ingredients cook_time
: Cooking time source
: Recipe source (e.g. Food Network, Allrecipes) For example, to print the title and ingredients of the first recipe in the list, you can use:
recipe = recipes[0]
print(recipe.title)
print(recipe.ingredients)
Hackereat also provides cooking tips and tricks. To get a random cooking tip, simply call the get_cooking_tip
method:
tip = client.get_cooking_tip()
print(tip)
With Hackereat, you can easily search for recipes and get cooking tips, all within your Python environment. Give it a try and impress your friends and family with your culinary skills!