📡 Connect & Read Primitives — app2.6
Developer CourseModule 2: Connect & Read Primitivesapp2.6
Reading8 min

From curl to Code: Your First Python Read

📡 Module 2: Connect & Read Primitives

The Python SDK: pip install energyatit

The Python SDK wraps every API call in typed, documented methods. No more remembering URLs and headers.

Install It

# Check Python is installed
python3 --version
# Expected: Python 3.9+

# Install the SDK
pip3 install energyatit

# Verify it installed
python3 -c "import energyatit; print('SDK installed:', energyatit.__version__)"

Your First SDK Script

Create a file called hello_grid.py:

import os
from energyatit import EnergyAtItClient

# Use environment variable for API key (never hardcode)
client = EnergyAtItClient(
    api_key=os.environ.get("EAT_KEY", "eat_test_YOUR_KEY")
)

# List sites
sites = client.sites.list()
for site in sites:
    print(f"Site: {site['name']} (ID: {site['id']})")

# List assets for first site
if sites:
    assets = client.assets.list(site_id=sites[0]['id'])
    for asset in assets:
        print(f"  Asset: {asset['name']} — {asset['type']}")

Run it:

export EAT_KEY="eat_test_YOUR_KEY_HERE"
python3 hello_grid.py

SDK vs curl

FeaturecurlPython SDK
AuthManual headerAutomatic
ParsingManual JSONTyped objects
ErrorsStatus codesExceptions
RetriesManualBuilt-in
DiscoverabilityRead docsAutocomplete

The SDK does not do anything curl cannot do. It just makes it faster, safer, and less error-prone.

Log in to track your progress and earn certifications.