**Today I called the Claude API from Python for the very first time.
**
** What I Was Learning**
The exercise was built around a relatable scenario, an account manager who manually writes weekly performance summaries for 10 clients every Monday. Same structure every week. Only the numbers change.
The goal wasn't to ship a product. The goal was to learn how to connect Python to Claude API and move data through a structured pipeline from start to finish.
What the Exercise Taught Me
The full data pipeline looked like this:
clients.csv → read_client_data() → list of dictionaries
↓
for loop picks up first client
↓
build_prompt() constructs personalised prompt
↓
generate_report() calls Claude API → returns report text
↓
save_report() writes to disk → returns filepath
↓
loop moves to next client
↓
summary printed + results logged to JSON
Three things I will carry into every project from here:
- `Path(file).parent': how to make scripts work regardless of where they are run from
-
client.messages.create(): the exact pattern for calling Claude API in Python - The function-per-job pattern: organising a script into small single purpose functions connected by
main().
Why This Feels Like a Milestone
Every workflow I've built in the first 3 days used n8n to handle the Claude API connection visually. Today I learned how to do that same thing in raw Python. No drag and drop. No visual nodes. Just code.
That's a different kind of understanding. And it opens up a completely different level of what I can build next.
Still learning. Still building. One day at a time.
52 more to go.
Top comments (0)