Skip to content

Python client for the European Commission AgriData API

License

Notifications You must be signed in to change notification settings

a1oysio/pyagridata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

pyagridata

A Python wrapper for accessing agricultural market data from the European Commission's AgriFood Data Portal.


β˜‘οΈ Overview

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

πŸš€ Installation

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}")

πŸ“¦ Project Structure

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

πŸ›  Requirements

  • Python β‰₯ 3.9

  • requests

πŸ“„ License

Distributed under the MIT License. See the file LICENSE for more details.

About

Python client for the European Commission AgriData API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages