recipe_extractor_tools documentation

Add your content using reStructuredText syntax. See the reStructuredText documentation for details.

pydantic model recipe_extractor_tools.listings.Listing

Bases: BaseModel

Represents the listing item for a scraper.

Show JSON schema
{
   "title": "Listing",
   "description": "Represents the listing item for a scraper.",
   "type": "object",
   "properties": {
      "id": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The database id.",
         "title": "Id"
      },
      "link": {
         "description": "The url of the recipe.",
         "title": "Link",
         "type": "string"
      },
      "mode": {
         "$ref": "#/$defs/Mode",
         "description": "The listing mode for a listing item."
      },
      "startdate": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "When the url scraping was started.",
         "title": "Startdate"
      },
      "enddate": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "When the url scraping was finished.",
         "title": "Enddate"
      },
      "successful": {
         "default": false,
         "description": "True if the scraping of the item finished without error.",
         "title": "Successful",
         "type": "boolean"
      },
      "attempts": {
         "default": 0,
         "description": "Number of scraping attempts.",
         "title": "Attempts",
         "type": "integer"
      }
   },
   "$defs": {
      "Mode": {
         "description": "The different scraping modes.",
         "enum": [
            "categories_listing",
            "categories_listing_page",
            "recipe_links",
            "recipe_details"
         ],
         "title": "Mode",
         "type": "string"
      }
   },
   "required": [
      "link",
      "mode"
   ]
}

Fields:
field attempts: int = 0

Number of scraping attempts.

field enddate: datetime | None = None

When the url scraping was finished.

field id: int | None = None

The database id.

The url of the recipe.

field mode: Mode [Required]

The listing mode for a listing item.

field startdate: datetime | None = None

When the url scraping was started.

field successful: bool = False

True if the scraping of the item finished without error.

class recipe_extractor_tools.modes.Mode(*values)

Bases: str, Enum

The different scraping modes.

CATEGORIES_LISTING = 'categories_listing'
CATEGORIES_LISTING_PAGE = 'categories_listing_page'
RECIPE_DETAILS = 'recipe_details'
pydantic model recipe_extractor_tools.details.Details

Bases: BaseModel

Represents the details of a scraped recipe.

Show JSON schema
{
   "title": "Details",
   "description": "Represents the details of a scraped recipe.",
   "type": "object",
   "properties": {
      "id": {
         "description": "The database id.",
         "title": "Id",
         "type": "integer"
      },
      "link": {
         "description": "The url of the recipe.",
         "title": "Link",
         "type": "string"
      },
      "startdate": {
         "description": "When the url scraping was started.",
         "format": "date-time",
         "title": "Startdate",
         "type": "string"
      },
      "enddate": {
         "description": "When the url scraping was finished.",
         "format": "date-time",
         "title": "Enddate",
         "type": "string"
      },
      "successful": {
         "successful": "True if the scraping was completed without issue.",
         "title": "Successful",
         "type": "boolean"
      },
      "data": {
         "$ref": "#/$defs/Recipe",
         "description": "The recipe data."
      },
      "attempts": {
         "description": "Number of scraping attempts.",
         "title": "Attempts",
         "type": "integer"
      }
   },
   "$defs": {
      "Ingredient": {
         "description": "Represents an ingredient in a recipe, including its quantity and name.",
         "properties": {
            "quantity_unit": {
               "default": "",
               "description": "The quantity of an ingredient including the unit (default value = '')",
               "title": "Quantity Unit",
               "type": "string"
            },
            "ingredient_name": {
               "default": "",
               "description": "The name of an ingredient (default value = '')",
               "title": "Ingredient Name",
               "type": "string"
            }
         },
         "title": "Ingredient",
         "type": "object"
      },
      "Method": {
         "description": "Represents a method step in a recipe.",
         "properties": {
            "step_number": {
               "default": 0,
               "description": "The integer of the step number of the method (default value = 0)",
               "title": "Step Number",
               "type": "integer"
            },
            "instruction": {
               "default": "",
               "description": "The string of instruction for the current step (default value = '')",
               "title": "Instruction",
               "type": "string"
            }
         },
         "title": "Method",
         "type": "object"
      },
      "Recipe": {
         "description": "Represents a recipe with its name, portions, time, and other details.",
         "properties": {
            "name": {
               "default": "",
               "description": "The name of the recipe on the website (default value = '')",
               "title": "Name",
               "type": "string"
            },
            "portions": {
               "default": 0,
               "description": "The interger number of portions included in the recipe (default value = 0).",
               "title": "Portions",
               "type": "string"
            },
            "preparation_time": {
               "default": "",
               "description": "The preparation time appearing on the website including the units (default value = '')",
               "title": "Preparation Time",
               "type": "string"
            },
            "cooking_time": {
               "default": "",
               "description": "The cooking time appearing on the website including the units (default value = '')",
               "title": "Cooking Time",
               "type": "string"
            },
            "total_time": {
               "default": "",
               "description": "The total time appearing on the website including the units (default value = '')",
               "title": "Total Time",
               "type": "string"
            },
            "categories": {
               "description": "The recipe categories appearing on the website as a list of strings (default value = [])",
               "items": {
                  "type": "string"
               },
               "title": "Categories",
               "type": "array"
            },
            "keywords": {
               "description": "The recipe keywords appearing on the website as a list of strings (default value = [])",
               "items": {
                  "type": "string"
               },
               "title": "Keywords",
               "type": "array"
            },
            "ingredients": {
               "description": "The ingredients list for the recipe (default value = [])",
               "items": {
                  "$ref": "#/$defs/Ingredient"
               },
               "title": "Ingredients",
               "type": "array"
            },
            "method": {
               "description": "The method of the recipe (default_value = [])",
               "items": {
                  "$ref": "#/$defs/Method"
               },
               "title": "Method",
               "type": "array"
            }
         },
         "title": "Recipe",
         "type": "object"
      }
   },
   "required": [
      "id",
      "link",
      "startdate",
      "enddate",
      "successful",
      "data",
      "attempts"
   ]
}

Fields:
field attempts: int [Required]

Number of scraping attempts.

field data: Recipe [Required]

The recipe data.

field enddate: datetime [Required]

When the url scraping was finished.

field id: int [Required]

The database id.

The url of the recipe.

field startdate: datetime [Required]

When the url scraping was started.

field successful: bool [Required]
pydantic model recipe_extractor_tools.details.Ingredient

Bases: BaseModel

Represents an ingredient in a recipe, including its quantity and name.

Show JSON schema
{
   "title": "Ingredient",
   "description": "Represents an ingredient in a recipe, including its quantity and name.",
   "type": "object",
   "properties": {
      "quantity_unit": {
         "default": "",
         "description": "The quantity of an ingredient including the unit (default value = '')",
         "title": "Quantity Unit",
         "type": "string"
      },
      "ingredient_name": {
         "default": "",
         "description": "The name of an ingredient (default value = '')",
         "title": "Ingredient Name",
         "type": "string"
      }
   }
}

Fields:
field ingredient_name: str = ''

The name of an ingredient (default value = ‘’)

field quantity_unit: str = ''

The quantity of an ingredient including the unit (default value = ‘’)

pydantic model recipe_extractor_tools.details.Method

Bases: BaseModel

Represents a method step in a recipe.

Show JSON schema
{
   "title": "Method",
   "description": "Represents a method step in a recipe.",
   "type": "object",
   "properties": {
      "step_number": {
         "default": 0,
         "description": "The integer of the step number of the method (default value = 0)",
         "title": "Step Number",
         "type": "integer"
      },
      "instruction": {
         "default": "",
         "description": "The string of instruction for the current step (default value = '')",
         "title": "Instruction",
         "type": "string"
      }
   }
}

Fields:
field instruction: str = ''

The string of instruction for the current step (default value = ‘’)

field step_number: int = 0

The integer of the step number of the method (default value = 0)

pydantic model recipe_extractor_tools.details.Recipe

Bases: BaseModel

Represents a recipe with its name, portions, time, and other details.

Show JSON schema
{
   "title": "Recipe",
   "description": "Represents a recipe with its name, portions, time, and other details.",
   "type": "object",
   "properties": {
      "name": {
         "default": "",
         "description": "The name of the recipe on the website (default value = '')",
         "title": "Name",
         "type": "string"
      },
      "portions": {
         "default": 0,
         "description": "The interger number of portions included in the recipe (default value = 0).",
         "title": "Portions",
         "type": "string"
      },
      "preparation_time": {
         "default": "",
         "description": "The preparation time appearing on the website including the units (default value = '')",
         "title": "Preparation Time",
         "type": "string"
      },
      "cooking_time": {
         "default": "",
         "description": "The cooking time appearing on the website including the units (default value = '')",
         "title": "Cooking Time",
         "type": "string"
      },
      "total_time": {
         "default": "",
         "description": "The total time appearing on the website including the units (default value = '')",
         "title": "Total Time",
         "type": "string"
      },
      "categories": {
         "description": "The recipe categories appearing on the website as a list of strings (default value = [])",
         "items": {
            "type": "string"
         },
         "title": "Categories",
         "type": "array"
      },
      "keywords": {
         "description": "The recipe keywords appearing on the website as a list of strings (default value = [])",
         "items": {
            "type": "string"
         },
         "title": "Keywords",
         "type": "array"
      },
      "ingredients": {
         "description": "The ingredients list for the recipe (default value = [])",
         "items": {
            "$ref": "#/$defs/Ingredient"
         },
         "title": "Ingredients",
         "type": "array"
      },
      "method": {
         "description": "The method of the recipe (default_value = [])",
         "items": {
            "$ref": "#/$defs/Method"
         },
         "title": "Method",
         "type": "array"
      }
   },
   "$defs": {
      "Ingredient": {
         "description": "Represents an ingredient in a recipe, including its quantity and name.",
         "properties": {
            "quantity_unit": {
               "default": "",
               "description": "The quantity of an ingredient including the unit (default value = '')",
               "title": "Quantity Unit",
               "type": "string"
            },
            "ingredient_name": {
               "default": "",
               "description": "The name of an ingredient (default value = '')",
               "title": "Ingredient Name",
               "type": "string"
            }
         },
         "title": "Ingredient",
         "type": "object"
      },
      "Method": {
         "description": "Represents a method step in a recipe.",
         "properties": {
            "step_number": {
               "default": 0,
               "description": "The integer of the step number of the method (default value = 0)",
               "title": "Step Number",
               "type": "integer"
            },
            "instruction": {
               "default": "",
               "description": "The string of instruction for the current step (default value = '')",
               "title": "Instruction",
               "type": "string"
            }
         },
         "title": "Method",
         "type": "object"
      }
   }
}

Fields:
field categories: List[str] [Optional]

The recipe categories appearing on the website as a list of strings (default value = [])

field cooking_time: str = ''

The cooking time appearing on the website including the units (default value = ‘’)

field ingredients: List[Ingredient] [Optional]

The ingredients list for the recipe (default value = [])

field keywords: List[str] [Optional]

The recipe keywords appearing on the website as a list of strings (default value = [])

field method: List[Method] [Optional]

The method of the recipe (default_value = [])

field name: str = ''

The name of the recipe on the website (default value = ‘’)

field portions: str = 0

The interger number of portions included in the recipe (default value = 0).

field preparation_time: str = ''

The preparation time appearing on the website including the units (default value = ‘’)

field total_time: str = ''

The total time appearing on the website including the units (default value = ‘’)