Current version: v0.1.0
Tags: aclimate, climate, agriculture, python, sdk, api
AClimate SDK PY is an asynchronous Python client for consuming endpoints from the AClimate v3 API. It provides typed methods for authentication, countries, administrative regions, locations, historical climate data, climatology, agroclimatic indicators, GeoServer point data, and available periods.
The SDK is designed to be installed directly from GitHub and used by applications, APIs, notebooks, and LLM/RAG workflows that need structured access to AClimate climate and agroclimatic data.
This project is configured to work with uv for dependency management, virtual environments, locking, testing, and package installation.
Before installing the SDK, make sure you have:
- Python
3.10or higher. uvinstalled.- A valid AClimate API client ID and client secret, or an access token.
Install uv if needed:
pip install uvInside another uv project, add it as a dependency:
uv add git+https://github.com/CIAT-DAPA/aclimatesdkpy.gitInstall directly from GitHub with uv:
uv pip install git+https://github.com/CIAT-DAPA/aclimatesdkpy.gitIf you use uv add:
uv remove aclimatesdkpyIf you use uv pip install:
uv pip uninstall aclimatesdkpyimport asyncio
from aclimatesdkpy.aclimate_client import get_client
api_base_url = "https://api.aclimate.org/"
client_id = ""
client_secret = ""
client = await get_client(
base_url=api_base_url,
client_id=client_id,
client_secret=client_secret,
)You can also use an existing bearer token:
import asyncio
from aclimatesdkpy import AClimateClient
async with AClimateClient(access_token="YOUR_ACCESS_TOKEN") as client:
countries = await client.get_countries()await client.get_client_token()
await client.validate_token()The SDK automatically obtains and refreshes a client-credentials token when client_id and client_secret are configured.
Endpoints are included:
| SDK method | API endpoint |
|---|---|
get_client_token |
/auth/get-client-token |
validate_token |
/auth/token/validate |
get_countries |
/countries |
get_countries_by_name |
/countries/by-name |
get_admin1_by_country_ids |
/admin1/by-country-ids |
get_locations_by_machine_name |
/locations/by-machine-name |
get_locations_by_id |
/locations/by-id |
get_locations_by_country_ids_with_data |
/locations/by-country-ids-with-data |
get_historical_daily_minmax_by_location |
/historical-daily/minmax-by-location |
get_historical_daily_by_date_range_all_measures |
/historical-daily/by-date-range-all-measures |
get_historical_monthly_by_date_range_all_measures |
/historical-monthly/by-date-range-all-measures |
get_historical_monthly_minmax_by_location |
/historical-monthly/minmax-by-location |
get_climatology_minmax_by_location |
/climatology/minmax-by-location |
get_climatology_by_month_range_location_ids_all_measures |
/climatology/by-month-range-location-ids-all-measures |
get_indicator_by_location_id |
/indicator/by-location-id |
get_indicator_by_location_date_period |
/indicator/by-location-date-period |
get_indicator_minmax_by_location |
/indicator/minmax-by-location |
get_indicators_by_category_id |
/indicator-mng/by-category-id |
get_indicators_by_country |
/indicator-mng/by-country |
get_indicator_categories_by_category |
/indicator-category-mng/by-category |
get_indicator_categories_by_country |
/indicator-category-mng/by-country |
get_indicator_features_by_indicator_and_country |
/indicator-features/by-indicator-and-country |
get_geoserver_point_data |
/geoserver/point-data |
get_available_periods |
/periods/available |
- Endpoints documented with
location_idaccept a single integer. - Endpoints documented with
location_idsorcountry_idsaccept either a comma-separated string or a Python list such as[1, 2, 3]. - Date parameters accept
YYYY-MM-DDstrings ordatetime.dateobjects.
countries = await client.get_countries_by_name("Colombia")admin1 = await client.get_admin1_by_country_ids([1, 2, 3])locations = await client.get_locations_by_country_ids_with_data(country_ids=[1], days=7)records = await client.get_historical_daily_by_date_range_all_measures(
location_ids=[101, 102],
start_date="2025-05-01",
end_date="2025-05-26",
)The ContextBuilder can generate narrative context in English or Spanish. English is the default.
from aclimatesdkpy import ContextBuilder
# English output
builder = ContextBuilder(language="en")
text = builder.daily_climate_summary(records)
print(text)
# Spanish output
builder_es = ContextBuilder(language="es")
text_es = builder_es.daily_climate_summary(records)
print(text_es)You can also switch the language in place:
builder.set_language("es")Currently supported languages are:
| Code | Language |
|---|---|
en |
English |
es |
Spanish |
aclimatesdkpy/
βββ .python-version
βββ pyproject.toml
βββ uv.lock
βββ README.md
βββ src/
β βββ aclimatesdkpy/
β βββ __init__.py
β βββ aclimate_api_error.py
β βββ aclimate_auth_error.py
β βββ aclimate_client.py
β βββ aclimate_models.py
β βββ context_builder.py
β βββ utils.py
βββ tests/
βββ test_client.py
For local development:
git clone https://github.com/CIAT-DAPA/aclimatesdkpy.git
cd aclimatesdkpy
uv venvCreate or update the virtual environment from the lockfile:
uv sync --all-extras --devRun commands inside the managed environment:
uv run python examples/basic_usage.pyRun tests:
uv run pytestRun linting:
uv run ruff check .Run static typing:
uv run mypy srcBuild the package:
uv buildUpdate the lockfile after dependency changes:
uv lockMIT License.