API/Python

From Open Food Facts wiki
Revision as of 15:05, 20 May 2022 by Teolemon (talk | contribs)
Jump to navigation Jump to search

Documentation of the Python bindings

Online API

https://github.com/openfoodfacts/openfoodfacts-python

Offline API

Source code

https://github.com/openfoodfacts/OpenFoodFacts-APIRestPython

How to install

  • Install python 3
  • Install mongodb
  • Install pip
  • Install requirements : $ pip install -r requirements.txt
  • Download the database from : http://world.openfoodfacts.org/data/openfoodfacts-mongodbdump.tar.gz
  • Import to local mongodb : $ mongorestore -d off -c products /foldertobsonfile/products.bson
  • Launch api : $ python3 runApiRESTServer.py
  • That's all !

How to use