nokey.food package
Submodules
nokey.food.fruityvice module
- class nokey.food.fruityvice.Fruityvice(use_caching=False, cache_name='fruityvice_cache', backend='sqlite', expire_after=3600)[source]
Bases:
objectA class to interact with the Fruityvice API.
- base_url
The base url of the Fruityvice API.
- about
A short description of the API.
- get_all_fruit()[source]
Returns all the fruit listed in the Fruityvice API.
- Parameters:
None –
- Returns:
Dictionary containing all the fruit listed in the API.
- Return type:
dict
- get_docs_url()[source]
Returns the url for the Fruityvice API documentation.
- Parameters:
None –
- Returns:
URL for API documentation.
- Return type:
string
- get_fruit_by_family(family)[source]
Returns fruit matching the given family.
- Parameters:
family (str) – The name of a fruit family.
- Returns:
Dictionary containing fruit of the given family.
- Return type:
dict
- get_fruit_by_genus(genus)[source]
Returns fruit matching the given genus.
- Parameters:
genus (str) – The name of a fruit genus.
- Returns:
Dictionary containing fruit of the given genus.
- Return type:
dict
- get_fruit_by_nutrition(nutrition, minVal=0, maxVal=1000)[source]
Returns a fruit with its information based on a minimum and maximum range of values for the specified nutritional component.
- Parameters:
nutrition (str) – A nutritional component. Possible values are carbohydrates, protein, fat, calories, and sugar.
minVal (float) – The minimum value of the range specified for nutritional component (per 100g of the fruit). Defaults to its minimum possible value, which is 0.
maxVal (float) – The maximum value of the range specified for nutritional component (per 100g of the fruit). Defaults to its maximum possible value, which is 1000.
- Returns:
Dictionary containing information on the fruit matching the specified values.
- Return type:
dict