ChileAtiende Python SDK
A modern, fully typed synchronous and asynchronous Python SDK for consuming the official ChileAtiende API provided by the Government of Chile (https://www.chileatiende.gob.cl/desarrolladores).
🚀 Features
- Full Async & Sync Support: Built on
httpxfor both synchronous workflows and asynchronous (async/await) executions. - Pydantic v2 Models: Strongly typed and validated response models (
Ficha,Servicio,Sucursal, feeds, and envelopes). - Typed Error Hierarchy: Clear, actionable exceptions (
AuthenticationError,NotFoundError,RequestValidationError,APIError). - PEP 561 / Strict Mypy: Fully annotated with type hints, ready for
--strictmypy type checking. - Flexible Authentication: Configure API credentials via direct parameters or environment variables (
CHILEATIENDE_ACCESS_TOKEN).
📦 Installation
pip install chileatiende-sdk
Or using Poetry:
poetry add chileatiende-sdk
🔑 Authentication
To make requests to the ChileAtiende API, an access_token is required. You can obtain one from the official developers portal and supply it directly or set it in your environment:
export CHILEATIENDE_ACCESS_TOKEN="your_access_token_here"
💡 Quick Examples
Synchronous Usage (SyncChileAtiendeSDK)
from chileatiende_sdk import ChileAtiendeSDK
with ChileAtiendeSDK(access_token="your_access_token") as client:
# Fetch a procedure sheet (Ficha) by ID
ficha = client.get_ficha(1)
print(f"Ficha ID: {ficha.id}")
print(f"Title: {ficha.titulo}")
print(f"Institution: {ficha.servicio}")
# Search and list Fichas
fichas_feed = client.list_fichas(query="pension", max_results=5)
for item in fichas_feed.items:
print(f"- {item.titulo}")
# List all state services/institutions
servicios_feed = client.list_servicios()
print(f"Total Institutions: {len(servicios_feed.items)}")
Asynchronous Usage (AsyncChileAtiendeSDK)
import asyncio
from chileatiende_sdk import AsyncChileAtiendeSDK
async def main():
async with AsyncChileAtiendeSDK(access_token="your_access_token") as client:
# Fetch detailed service information
servicio = await client.get_servicio("AD001")
print(f"Service: {servicio.titulo} ({servicio.sigla})")
# List physical branch offices
sucursales = await client.list_sucursales(mobile_offices=False)
print(f"Total Branches: {sucursales.total or len(sucursales.items)}")
asyncio.run(main())
🛠️ API Resource Coverage
| Resource | Method Name | Description |
|---|---|---|
| Fichas | get_ficha(ficha_id) |
Retrieve details for a procedure sheet by ID |
| Fichas | list_fichas(query, max_results, page_token) |
List and search procedure sheets with pagination |
| Fichas by Service | list_fichas_by_servicio(servicio_id) |
List procedure sheets for a specific state institution |
| Servicios | get_servicio(servicio_id) |
Retrieve details for a state service/institution |
| Servicios | list_servicios() |
List all state services publishing in ChileAtiende |
| Sucursales | get_sucursal(sucursal_id) |
Retrieve details for a branch office |
| Sucursales | list_sucursales(mobile_offices) |
List branch offices or filter mobile offices |
🚨 Exception Handling
from chileatiende_sdk import ChileAtiendeSDK
from chileatiende_sdk.errors import (
AuthenticationError,
NotFoundError,
RequestValidationError,
APIError,
)
try:
with ChileAtiendeSDK() as client:
ficha = client.get_ficha(999999)
except AuthenticationError:
print("Invalid or missing access token.")
except NotFoundError:
print("The requested procedure sheet does not exist.")
except RequestValidationError as e:
print(f"Invalid parameter value: {e}")
except APIError as e:
print(f"API request error: {e}")
📄 License
This project is licensed under the MIT License. See LICENSE.md for details.
Metadata
Release files for chileatiende-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chileatiende_sdk-0.1.0.tar.gz | 11.2 kB | With provenance | Details for chileatiende_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chileatiende_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for chileatiende_sdk-0.1.0-py3-none-any.whl |
Total release size: 27.9 kB
Release files / chileatiende_sdk-0.1.0.tar.gz
| Download URL | chileatiende_sdk-0.1.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80d9e3ae2025ab8316900efcdbe20a1f3da4d62aa8507ea3c27e0b6af16cfe34
|
|
BLAKE2b-256 checksum How to use checksums |
7aaf858193a014726ab38dbea5db9b32e2f2b026177820752bf6cb80a0d2ba65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.
Transparency logRelease files / chileatiende_sdk-0.1.0-py3-none-any.whl
| Download URL | chileatiende_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
412471b577264047e6a5b93d072b0c9a498ec053cd05451f14e5c07d62ebf54d
|
|
BLAKE2b-256 checksum How to use checksums |
969b81755c7dce1c15bf4b06c2a7c6674ba4f6995aa838544b6ea2c7d17718bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.
Transparency logSecurity for chileatiende-sdk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for chileatiende_sdk-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.