openfoodfacts
Official Python SDK of Open Food Facts
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 openfoodfactsuv
uv add openfoodfactspoetry
poetry add openfoodfactsInstalling 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
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
keepaQuery Amazon product data and pricing history…
permissive · top 15,000 on PyPI
openbb-imfProvides a provider extension for the OpenBB…
agpl · top 15,000 on PyPI
africastalkingProvides Python access to Africa's Talking APIs…
permissive · top 15,000 on PyPI
linkup-sdkA Python client library for the Linkup API that…
permissive · top 15,000 on PyPI
google-shopping-merchant-productsPython client library for Google Shopping…
permissive · top 15,000 on PyPI
googleadsClient library for interacting with Google Ad…
permissive · top 5,000 on PyPI
distroDistro provides a reliable, machine-readable…
permissive · top 1,000 on PyPI
garminconnectPython wrapper for the Garmin Connect API that…
permissive · top 15,000 on PyPI
AEMET-OpenDataPython client for the AEMET OpenData Rest API…
copyleft · top 15,000 on PyPI
barcodenumberValidates product codes across multiple barcode…
copyleft · top 15,000 on PyPI