Skip to main content

Python SDK for agrodigital.io.

Project description

AgroDigital Python SDK

PyPI version License: MIT

A modern, easy-to-use Python SDK for interacting with the agrodigital.io API. This library provides a high-level interface to manage agricultural entities, IoT data, meteorological stations, and satellite imagery analysis.

Features

  • Entity Management: CRUD operations for Farms, Fields, Polygons, and Crops.
  • Monitoring & Data: Specialized access to Raster imagery, indexes, and Google Earth Engine clusters.
  • IoT & Meteo: Seamless integration with IoT stations and meteorological data.
  • Operations Logs: Track sowing, applications, and logs.
  • Scouting: Manage bugs, weeds, and diseases via waypoints.
  • Object-Oriented: All API responses are converted into Python objects with dot-notation access.

Installation

You can install the SDK via pip:

pip install agrodigital_io

Or using poetry:

poetry add agrodigital_io

Quick Start

Authentication

To begin, initialize the AgroDigitalClient using either your API token or your username and password.

from agrodigital_io import AgroDigitalClient

# Option 1: Using an API Token
client = AgroDigitalClient(token="your_api_token_here")

# Option 2: Using Credentials
client = AgroDigitalClient(username="your_username", password="your_password")

Basic Operations

List all farms

farms = client.farms.list()
for farm in farms:
    print(f"Farm: {farm.name} (ID: {farm.id})")

Get field data

field = client.fields.retrieve(id=123)
print(f"Field name: {field.name}")
print(f"Associated crop: {field.crop.name}") # Nested objects supported

Fetch IoT Data

# Get data from a specific station between dates
data = client.iot_data.list_data(
    station_id=45, 
    from_date="2023-01-01", 
    to_date="2023-01-07",
    variables=["temperature", "humidity"]
)

Advanced Usage

Raster and Imagery

Access satellite imagery metadata and available dates for specific polygons.

dates = client.rasters.available_dates()
print(f"Available imagery dates: {dates}")

Cluster Retrieval

Fetch Google Earth Engine or local clusters for a specific polygon and date range.

clusters = client.cluster.ee_retrieve(
    from_date="2023-01-01",
    to_date="2023-12-31",
    polygon_id="poly_88",
    n_clusters=5
)

Error Handling

The SDK raises AgroDigitalError for API-related issues, including connection timeouts and non-200 status codes.

from agrodigital_io import AgroDigitalError

try:
    client.fields.retrieve(999999)
except AgroDigitalError as e:
    print(f"Error: {e.message}")
    print(f"Status Code: {e.status_code}")

Requirements

  • Python >= 3.10
  • requests library

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agrodigital_io-0.1.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agrodigital_io-0.1.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file agrodigital_io-0.1.1.tar.gz.

File metadata

  • Download URL: agrodigital_io-0.1.1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agrodigital_io-0.1.1.tar.gz
Algorithm Hash digest
SHA256 17e64f437ec89e6edf7afa506352891a6e9b8cd73f2505faacca32420b09b9f0
MD5 43d3879d73e6d954ead288ecdc70b051
BLAKE2b-256 82002cf9f995a55a77f8f917d10e71f91346caf3b27304b023bec03005b9a1eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for agrodigital_io-0.1.1.tar.gz:

Publisher: python-publish.yml on agro-digital/agrodigital-io-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agrodigital_io-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: agrodigital_io-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for agrodigital_io-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e834a7456fea56cc43fe6e120218d1d50cc9ac234f72faa2ea1cf5275125787
MD5 c35f63bbfac0ec9cb9dcf6faf5d8014d
BLAKE2b-256 a6ce3e1d281513a93aef8c68941108075df69483b38fa391d3577d258a9430a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for agrodigital_io-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on agro-digital/agrodigital-io-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page