Skip to main content

Python Client for GridStatus.io API

Project description

gridstatus logo

Tests PyPI version

GridStatus.io Hosted API

Installation

gridstatusio supports Python 3.10+. Install with uv or pip.

uv pip install gridstatusio

Getting Started

  • Sign up for a Grid Status account and get your API key from the Settings page
  • Set your API key as an environment variable: export GRIDSTATUS_API_KEY=your_api_key or pass to the client with client = GridStatusClient(api_key="<your_api_key>")
  • You're now ready to start querying. List datasets with:
from gridstatusio.gs_client import GridStatusClient
client = GridStatusClient()

data = client.get_dataset('ercot_fuel_mix', limit=100, start='2025-01-01', end='2025-01-02')

Checking your API usage

usage = client.get_api_usage()
  • This shows the limits for your API key, the start and end of the current usage period, and the API usage in the current period. Note a limit of -1 means no limit.

Retry Configuration

  • The Grid Status API has rate limits that restrict the number of requests that are allowed each second, minute and hour. If rate limits are hit the client will automatically retry the request after a delay. You can configure the maximum number of retries using the max_retries parameter when initializing the client. If you find yourself hitting rate limits, you may need to add a delay between your requests. The Grid Status Pricing Page contains more details on specific rate limits.
  • The client retries failed requests due to rate limits (429), server errors (5xx), and network issues using exponential backoff. You can customize retry behavior:
client = GridStatusClient(
    max_retries=3,        # Maximum retries (default: 5)
    base_delay=1.0,       # Base delay in seconds (default: 2.0)
    exponential_base=1.5, # Exponential backoff multiplier (default: 2.0)
)

The retry delay follows the formula delay = base_delay * (exponential_base ** retry_count).

Retries are useful when:

  • You're making pagination-heavy requests and risk hitting short-term rate limits
  • A request fails due to a temporary server error
  • A network issue or timeout interrupts the request

To disable retries entirely, set max_retries=0.

Version Check

The client checks for updates to the library when it is imported. It does this by making a call to the library on PyPI. For certain applications, this call can be problematic, and can be disabled by setting the environment variable GSIO_SKIP_VERSION_CHECK to true.

export GSIO_SKIP_VERSION_CHECK=true

Open Source

If you prefer to use an open source library that fetches data directly from the source, you can check out this github repo.

Get Help

We'd love to answer any usage or data access questions! Please let us know by emailing us at contact@gridstatus.io

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

gridstatusio-0.15.1.tar.gz (984.8 kB view details)

Uploaded Source

Built Distribution

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

gridstatusio-0.15.1-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file gridstatusio-0.15.1.tar.gz.

File metadata

  • Download URL: gridstatusio-0.15.1.tar.gz
  • Upload date:
  • Size: 984.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gridstatusio-0.15.1.tar.gz
Algorithm Hash digest
SHA256 fc9884839053dd8863091362111ac6dc5b196fa89634988962a81003d4d43747
MD5 98fac06e734124d28e1afa4fce33be14
BLAKE2b-256 34fed241776613998bc1b0adf1d0b088efc64d1a08087153c5d698ec0b094ec8

See more details on using hashes here.

Provenance

The following attestation bundles were made for gridstatusio-0.15.1.tar.gz:

Publisher: release.yaml on gridstatus/gridstatusio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gridstatusio-0.15.1-py3-none-any.whl.

File metadata

  • Download URL: gridstatusio-0.15.1-py3-none-any.whl
  • Upload date:
  • Size: 21.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gridstatusio-0.15.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c5c4fbdee7a55b1240f05381fe381ccb23789d6b2c8fe55296d7631f22c6cdb
MD5 5972eecaeebbf4ac4ae28c713c871999
BLAKE2b-256 21be919c4818d7717c56400acab8150b0da3bd8993b3ac186f06a20046831075

See more details on using hashes here.

Provenance

The following attestation bundles were made for gridstatusio-0.15.1-py3-none-any.whl:

Publisher: release.yaml on gridstatus/gridstatusio

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