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/dispatchcurl.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
| Feature | curl | SDK |
|---|---|---|
| Authentication | Manual header every time | Set once, automatic |
| JSON parsing | Manual json.loads() | Automatic |
| Error handling | Check status codes manually | Typed exceptions |
| Retries | You build it | Built-in with backoff |
| Rate limiting | You handle 429s | Automatic with backoff |
| Documentation | Read the API docs | Autocomplete + 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.