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.2.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.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agrodigital_io-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 83adc9dc41225d1491c7f71e052397f25286b3999d4ae8bd484e082f01dc4ee0
MD5 a827359b39aaf5bb2d7394864c9568b7
BLAKE2b-256 10408827b7112b7c73f6a0c7c6837b001172edc8224aef00764e36cd556ee15e

See more details on using hashes here.

Provenance

The following attestation bundles were made for agrodigital_io-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: agrodigital_io-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 115266a0075ea8437cac31863f0ded592ad3769d435fefb58e0b93b43df2c584
MD5 c970f21a9b08b3de565390325adcad7f
BLAKE2b-256 3a686c0a27a71879130d8a914e47e1c04aeac5493f64ae3fe1615db2545d58c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for agrodigital_io-0.1.2-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