🐍 The Python SDK — app6.1
Developer CourseModule 6: The Python SDKapp6.1
Reading8 min

Why an SDK Beats Raw HTTP Every Time

🐍 Module 6: The Python SDK

Why an SDK Beats Raw HTTP Every Time

You have been using curl for 5 modules. It works. But it is slow, error-prone, and hard to maintain in production.

The Python SDK wraps every API call in a typed, documented method. Autocomplete in your editor. Automatic retries. Proper error handling.

curl vs SDK — Side by Side

curl:

curl -X POST -H "Authorization: eat_test_abc123" \
  -H "Content-Type: application/json" \
  -d '{"asset_id": 1, "command": "charge", "target_kw": 50, "duration_minutes": 30}' \
  https://app.energyatit.com/api/v1/dispatch
curl.exe --% -X POST -H "Authorization: eat_test_abc123" -H "Content-Type: application/json" -d "{"asset_id": 1, "command": "charge", "target_kw": 50, "duration_minutes": 30}" "https://app.energyatit.com/api/v1/dispatch"

Python SDK:

client.dispatch.send(asset_id=1, command="charge", target_kw=50, duration_minutes=30)

One line. No URL. No headers. No JSON serialisation. No typos.

What the SDK Handles For You

FeaturecurlSDK
AuthenticationManual header every timeSet once, automatic
JSON parsingManual json.loads()Automatic
Error handlingCheck status codes manuallyTyped exceptions
RetriesYou build itBuilt-in with backoff
Rate limitingYou handle 429sAutomatic with backoff
DocumentationRead the API docsAutocomplete + docstrings

When to Use curl vs SDK

  • curl: Quick tests, debugging, one-off checks
  • SDK: Production code, scripts, automation, apps

Both talk to the same API. The SDK just makes it faster and safer.

Log in to track your progress and earn certifications.