/v1/scream,
emphasize key words in each entry with /v1/emphasize, and write the result
to a markdown file ready to paste into a release announcement. Along the way
you handle authentication, rate limits, and errors the way you would in a
real codebase.
What you will build
Given an input fileCHANGELOG.txt:
RELEASE_NOTES.md:
Prerequisites
- Python 3.10 or newer.
pip install requests.- An ACAAS API key. For the demo, any non-empty string works.
Step 1: A typed client wrapper
Start with a thinClient class. It centralizes the base URL, the auth
header, and the retry logic so the rest of the program reads like business
logic.
client.py
5xx (exponential backoff).
Step 2: Endpoint methods
Add one method per endpoint you need. Each is a one-liner over_post.
client.py (continued)
result
field for this tool. If you wanted to log which words were emphasized,
return data instead and let the caller pick fields.
Step 3: The amplifier
With the client in place, the program logic is short.amplify.py
Step 4: Pacing for larger changelogs
The version above issues one request per entry, plus one for the headline. For a fifty-line changelog that fits comfortably inside the 100-request demo window. For a five-hundred-line changelog it does not. Add proactive pacing inspired by the rate limiting guide:client.py (additional method)
amplify.py (modified)
429s into your logs.
Step 5: Smoke-test before shipping
A short test confirms each endpoint is reachable and your key works.smoke.py
What you learned
- One client, one session. Reusing a
requests.Sessionreuses TCP connections and centralizes headers. - Retry the recoverable, raise the rest.
429and5xxare worth retrying;401,413, and422are not. - Pace proactively when it matters. For one-off scripts,
429retries are fine. For batches, check status first and stretch the tail of the window evenly. - Compose endpoints. A useful tool rarely calls one endpoint —
/v1/screamfor the headline,/v1/emphasizefor the body, and they speak the same envelope shape.
Next steps
Errors reference
Every status code, with copy-paste handler patterns.
Rate limiting
Quota mechanics, the
status ladder, and proactive pacing.Experimental emphasis
The endpoint that picks emphasis for you. Tune
emphasis_ratio.Full API reference
Every endpoint, request, and response, in one place.