skillfed

openfoodfacts

Official Python SDK of Open Food Facts

openfoodfacts v5.3.0 80.0K downloads/30d#14,324 on PyPI461
Permissive license MIT Active released

What it is and what it does

openfoodfacts is the official Python SDK for querying and contributing to Open Food Facts, a crowdsourced food product database. It wraps the Open Food Facts REST API, letting you fetch product details by barcode, search by text, and submit new products or updates. The SDK handles common tasks like taxonomy field translation and data dump iteration, reducing boilerplate for typical workflows.

The package depends on requests for HTTP calls, pydantic for data validation, and tqdm for progress bars during bulk operations. It is actively maintained and marked Production/Stable, though the documentation notes the API is subject to change—pinning the version is recommended. Users must comply with both the MIT license of the SDK and the OdBL license of the underlying Open Food Facts data.

Use it for:

  • Look up nutritional and ingredient information for a product by scanning its barcode in a mobile or web app.
  • Build a food search feature that queries Open Food Facts for products matching user queries.
  • Contribute new product data or corrections to Open Food Facts from your application.
  • Download and process the Open Food Facts data dump for research or offline analysis.
  • Extract and translate taxonomized fields (e.g., allergens, categories) in multiple languages.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Query and manage product data from the Open Food Facts database via its official Python API, supporting product lookup, text search, and data creation or updates.

Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and is the official SDK for a widely used open food database. Install it if you need to integrate product lookup or food data into your application. Be aware that you must comply with OdBL licensing and register your application with the Open Food Facts project.

Install

openfoodfacts on PyPI

pip

pip install openfoodfacts

uv

uv add openfoodfacts

poetry

poetry add openfoodfacts

Installing openfoodfacts

Before you install

Low friction install with three lightweight dependencies (requests, pydantic, tqdm). Actively maintained with recent releases; last commit 2026-08-01. Marked Production/Stable and supports current Python versions.

License in practice

MIT license permits commercial and private use with attribution. Note that Open Food Facts data itself is under OdBL; SDK users must comply with both licenses and register applications as documented in the REUSE guide.

Quickstart

pip install openfoodfacts

import openfoodfacts
api = openfoodfacts.API(user_agent="MyApp/1.0")
product = api.product.get("3017620422003", fields=["code", "product_name"])

Requires Python >=3.10; user_agent parameter is mandatory for API calls.

Verify before relying

  • Whether the API requires authentication beyond user_agent for write operations (create/update).
  • Rate limiting or quota constraints on API calls not documented in the excerpt.
  • Data freshness and update frequency of the Open Food Facts database.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 3 — requests, pydantic, tqdm
Maintenance actively maintained — 38 days since the last release
Last repo commit
First released
Downloads 80,024/month — #14,324 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: openfoodfacts-5.3.0-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

open food facts api clientproduct database lookupfood product searchbarcode product informationfood data api wrapperproduct nutrition datafood facts sdk
food-dataapi-clientcrowdsourced-database

More WWW/HTTP packages