Skip to main content

groundtruth-ag

Python client for the BRD Groundtruth API — read your own farm data (fields, weather, irrigation scheduling, soil health, yield history, equipment, market prices) from your own scripts.

This is a read-only v1: nothing here creates or modifies data in your account.

Install

pip install groundtruth-ag

Quickstart

Generate a personal API key at bishopresearch.com → Dashboard → Settings → API Keys, then:

from groundtruth_ag import Client

client = Client(api_key="brd_live_...")
# or: export BRD_API_KEY=brd_live_... and just call Client()

for field in client.fields.list():
    forecast = client.fields.weather(field["id"])
    schedule = client.fields.irrigation(field["id"], days=7)
    print(field["name"], schedule["schedule"])

Resources

Call Endpoint
client.me() GET /me — the account this key belongs to
client.fields.list() GET /fields
client.fields.get(field_id) GET /fields/{id}
client.fields.weather(field_id) GET /fields/{id}/weather
client.fields.irrigation(field_id, days=7) GET /fields/{id}/irrigation
client.soil_health.summary() GET /soil-health
client.yield_history.list() GET /yield-history
client.equipment.list() GET /equipment
client.market.prices() GET /market/prices

Full request/response shapes: https://developer.bishopresearch.com and the interactive reference at https://bishopresearch.com/api/v1/docs.

Errors

Every non-2xx response raises a typed exception, all subclasses of BRDAPIError:

from groundtruth_ag import Client, NotFoundError, RateLimitError, AuthenticationError

client = Client()
try:
    client.fields.get(999999)
except NotFoundError:
    print("no such field")
Exception HTTP status
AuthenticationError 401 — missing, invalid, or revoked key
NotFoundError 404
ValidationError 422
RateLimitError 429 — 60 requests/minute per key
ServerError 5xx
ConnectionError request never got a response (network/timeout)

429s and 5xx responses are retried automatically (2 retries, exponential backoff) before an exception is raised — RateLimitError/ServerError mean retries were already exhausted.

Context manager

with Client(api_key="brd_live_...") as client:
    print(client.me())
# connection closed automatically

Development

pip install -e ".[test]"
pytest

Design notes

  • Built on httpx. A sync client only for now; an AsyncClient mirroring the same resource classes on httpx.AsyncClient is a natural follow-on once there's demand, not built speculatively here.
  • Auth is a bearer token (Authorization: Bearer <key>) whether it's a personal API key today or an OAuth access token in the future — the transport layer doesn't care which, so a future OAuth flow wouldn't require a breaking change to this library's public API.
  • No pagination: every v1 resource returns a small, complete list (a farm's fields, not millions of rows), so none was added.

Download files

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

Source Distribution

groundtruth_ag-1.0.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

groundtruth_ag-1.0.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file groundtruth_ag-1.0.0.tar.gz.

File metadata

  • Download URL: groundtruth_ag-1.0.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for groundtruth_ag-1.0.0.tar.gz
Algorithm Hash digest
SHA256 76715ccdbb691242a4787416c5215581eaf20168a8c563e3748d59e7ba508a9a
MD5 705a27e406c9d6aba4900f17ec8d4c33
BLAKE2b-256 b93edf544034d6d74e514345aa6c137b4c61f448db323f8019e169ce25b48c60

See more details on using hashes here.

File details

Details for the file groundtruth_ag-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: groundtruth_ag-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for groundtruth_ag-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6926715cb9f1c7cc69441a004e5f6cd6a9d1db98dae339efdfd6e4ddd9434d0b
MD5 4153743f6a7fda32ad9d693b4c66aa1f
BLAKE2b-256 26c7625e4e9d5d848a52396c4159f82681b0bf9c02b316363a4b798a711e2427

See more details on using hashes here.

Supported by

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