Skip to content

numberpi/openfoodfacts-python

 
 

Repository files navigation

Open Food Facts client for your Python applications and scripts

=================================== ![Open Food Facts] (https://static.openfoodfacts.org/images/misc/openfoodfacts-logo-en-178x150.png)

What is Open Food Facts?

A food products database

Open Food Facts is a database of food products with ingredients, allergens, nutrition facts and all the tidbits of information we can find on product labels.

Made by everyone

Open Food Facts is a non-profit association of volunteers. 1800+ contributors like you have added 43 000+ products from 150 countries using our Android, iPhone or Windows Phone app or their camera to scan barcodes and upload pictures of products and their labels.

For everyone

Data about food is of public interest and has to be open. The complete database is published as open data and can be reused by anyone and for any use. Check-out the cool reuses or make your own!

Status

Project Status Average time to resolve an issue Percentage of issues still open

Contributing

The project is initially started by , other contributors include:

Copyright and License

Copyright 2016 Open Food Facts

Installation

sudo pip install git+https://github.com/openfoodfacts/openfoodfacts-python

or:

git clone https://github.com/openfoodfacts/openfoodfacts-python
cd openfoodfacts
sudo python setup.py install

### Docs

#### Facets

Get all available additives.

traces = openfoodfacts.facets.get_additives()

Get all available allergens.

allergens = openfoodfacts.facets.get_allergens()

Get all available brands.

brands = openfoodfacts.facets.get_brands()

Get all available categories.

categories = openfoodfacts.facets.get_categories()

Get all available countries.

countries = openfoodfacts.facets.get_countries()

Get all available entry dates.

entry_dates = openfoodfacts.facets.get_entry_dates()

Get all available ingredients.

ingredients = openfoodfacts.facets.get_ingredients()

Get all available languages.

languages = openfoodfacts.facets.get_languages()

Get all available packagings.

packagings = openfoodfacts.facets.get_packagings()

Get all available packaging codes.

codes = openfoodfacts.facets.get_packaging_codes()

Get all available purchase places.

places = openfoodfacts.facets.get_purchase_places()

Get all available stores.

stores = openfoodfacts.facets.get_stores()

Get all available trace types.

traces = openfoodfacts.facets.get_traces()

Get all available states.

states = openfoodfacts.facets.get_states()

Products by facet

Get all products for given facets.

products = openfoodfacts.products.get_by_facets({
  'trace': 'egg',
  'country': 'france',
})

Get all products for given additive.

products = openfoodfacts.products.get_by_additive(additive)

Get all products for given allergen.

products = openfoodfacts.products.get_by_allergen(allergen)

Get all products for given brand.

products = openfoodfacts.products.get_by_brand(brand)

Get all products for given category.

products = openfoodfacts.products.get_by_category(category)

Get all products for given country.

products = openfoodfacts.products.get_by_country(country)

Get all products for given entry date.

products = openfoodfacts.products.get_by_entry_date(entry_date)

Get all products for given ingredient.

products = openfoodfacts.products.get_by_ingredient(ingredient)

Get all products for given language.

products = openfoodfacts.products.get_by_language(language)

Get all products for given packaging.

products = openfoodfacts.products.get_by_packaging(packaging)

Get all products for given packaging code.

products = openfoodfacts.products.get_by_packaging_code(code)

Get all products for given purchase place.

products = openfoodfacts.products.get_by_purchase_place(place)

Get all products for given store.

products = openfoodfacts.products.get_by_store(store)

Get all products for given trace type.

products = openfoodfacts.products.get_by_trace(trace)

Get all products for given state.

products = openfoodfacts.products.get_by_state(state)

Product

Get a given product.

product = openfoodfacts.facets.get_product(barcode)

About

Python package for Open Food Facts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%