Skip to main content

Tiny fully-typed ERCOT API

Project description

tinyercot

Fully-typed Python client for the ERCOT Public API.

Why tiny? The entire hand-written codebase is ~420 lines. Everything else is auto-generated from ERCOT's OpenAPI spec.

Install

uv add tinyercot

Setup

export ERCOT_USERNAME="your-username"
export ERCOT_PASSWORD="your-password"
export ERCOT_SUBSCRIPTION_KEY="your-subscription-key"

Usage

Single Page

from datetime import date
import tinyercot

# Returns typed response with .data, .meta, .links
response = tinyercot.np4_190_cd.dam_stlmnt_pnt_prices(
    deliveryDateFrom=date(2025, 12, 29),
    settlementPoint="HB_HOUSTON",
)

# Convert to pandas DataFrame
df = response.to_df()

Pagination (Sync)

# Iterator - yields typed rows from all pages
for row in tinyercot.np4_190_cd.dam_stlmnt_pnt_prices_iter(
    deliveryDateFrom=date(2025, 12, 29),
):
    print(row.settlementPoint, row.settlementPointPrice)

# DataFrame - fetches all pages, returns single DataFrame
df = tinyercot.np4_190_cd.dam_stlmnt_pnt_prices_df(
    deliveryDateFrom=date(2025, 12, 29),
)

Pagination (Async + Rate Limited)

Async methods automatically rate-limit to 20 req/min with retry on 429:

import asyncio
import tinyercot

async def main():
    # Async iterator - rate-limited, non-blocking
    async for row in tinyercot.np4_190_cd.dam_stlmnt_pnt_prices_iter_async(
        deliveryDateFrom=date(2025, 12, 29),
    ):
        print(row.settlementPoint, row.settlementPointPrice)

    # Async DataFrame - rate-limited, non-blocking
    df = await tinyercot.np4_190_cd.dam_stlmnt_pnt_prices_df_async(
        deliveryDateFrom=date(2025, 12, 29),
    )

asyncio.run(main())

API Pattern

Every endpoint generates 5 methods:

Method Returns Use Case
endpoint() Response Single page
endpoint_iter() Iterator[Row] Stream all pages (sync)
endpoint_df() DataFrame All pages as DataFrame (sync)
endpoint_iter_async() AsyncIterator[Row] Stream all pages (async, rate-limited)
endpoint_df_async() DataFrame All pages as DataFrame (async, rate-limited)

Development

Create a .env file with your credentials, then run IPython with dev deps:

uv run --env-file .env --group dev -- ipython

Regenerate

uv run python tools/generate_client.py

With fresh response field data (requires credentials):

uv run --env-file .env python tools/generate_client.py --refresh

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

tinyercot-0.1.0.tar.gz (69.9 kB view details)

Uploaded Source

Built Distribution

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

tinyercot-0.1.0-py3-none-any.whl (71.4 kB view details)

Uploaded Python 3

File details

Details for the file tinyercot-0.1.0.tar.gz.

File metadata

  • Download URL: tinyercot-0.1.0.tar.gz
  • Upload date:
  • Size: 69.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.6

File hashes

Hashes for tinyercot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 11eb6faeb77184a213b1c68c7c77bd5fd11785b71dc81a41f085605f89dd07da
MD5 db5ddf0837c4da33eab6939cd10927b4
BLAKE2b-256 69b9e41d0738134b3e392ed633b507bc244fe6b43c9ac61a423d46574916b97e

See more details on using hashes here.

File details

Details for the file tinyercot-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tinyercot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 71.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.6

File hashes

Hashes for tinyercot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 510a32ebd604f61e09f670c3f149b11dc5affe0d940bdb74c19c917bae273be1
MD5 dbdebfc295c5a109c6f2bb45b7fec7e0
BLAKE2b-256 ad90b230ee5eece4e6c4db363c2617ade7167d3682aed73203b89d0ca29854ff

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 Pingdom Monitoring Sentry Error logging StatusPage Status page