API/Python: Difference between revisions

From Open Food Facts wiki
No edit summary
No edit summary
Line 1: Line 1:
Documentation of the Python bindings
Documentation of the Python bindings


== Source code ==  
 
== Offline API==
=== Source code ===
https://github.com/openfoodfacts/OpenFoodFacts-APIRestPython
https://github.com/openfoodfacts/OpenFoodFacts-APIRestPython
== How to install ==
=== How to install ===
* Install python 3
* Install python 3
* Install mongodb
* Install mongodb
Line 12: Line 14:
* Launch api : $ python3 runApiRESTServer.py
* Launch api : $ python3 runApiRESTServer.py
* That's all !
* That's all !
== How to use ==
=== How to use ===

Revision as of 15:45, 20 October 2016

Documentation of the Python bindings


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