A Python wrapper for accessing agricultural market data from the European Commission's AgriFood Data Portal.
pyagridata provides a simple client for retrieving agricultural market data directly from the official European Commission AgriData API [docs].
Main features:
- Safe and consistent HTTP requests with proper error handling
- Unified interface to query multiple data categories (cereals, fruits, vegetables, etc.)
- Installable directly from GitHub
From GitHub:
pip install git+https://github.com/a1oysio/pyagridata.git@mainπ§° Quick Start
from pyagridata import Client, HTTPError
client = Client(timeout=60)
params = {
'memberStateCodes': ['IT'],
# other params,
}
try:
data = client.cereal.get_prices(**params)
print(data)
except HTTPError as err:
print(f"API error: {err.status_code} β {err}")pyagridata/
βββ pyagridata/
β βββ __init__.py
β βββ client.py # BaseClient: low-level HTTP + error handling
β βββ service.py # Client: user-facing entrypoint, builds category services
β βββ api.py
β βββ enums.py
β βββ exceptions.py # Error, HTTPError
βββ LICENSE
βββ pyproject.toml
βββ setup.cfg
βββ README.md
-
Python β₯ 3.9
-
requests
Distributed under the MIT License. See the file LICENSE for more details.