Hook
You've already documented your API in Postman — so why are you writing the same boilerplate Python wrappers by hand, one endpoint at a time?
Why It Matters
Manually converting Postman collections into Python API clients is tedious, inconsistent, and doesn't scale. Every new endpoint means another nearly-identical function with the same signature, the same header destructuring, the same URL construction — just different enough that copy-paste breaks. This approach replaces that toil with a code generation pipeline that reads your Postman collection JSON and emits typed, callable Python functions as output. Once it works, adding fifty endpoints costs you the same effort as adding one.
What You'll Learn
- Extract API structure by scraping live network traffic and capturing it as a Postman collection
- Parse Postman collection JSON to pull out request definitions, parameters, and headers
- Generate typed Python functions with proper signatures using dataclasses and type hints
- Structure output functions around a shared auth object (
o) that carries base URL and headers - Use the generated code as scaffolding — either run it directly or paste it into a library like Code Engine
From Postman JSON to Callable Python: How the Generator Works
The workflow starts before any code generation — in the browser. By right-clicking, opening DevTools, and simply clicking through Domo's UI, you capture the actual API calls being made. That network traffic becomes the raw material for a Postman collection, giving you a structured JSON document that describes every endpoint you care about.
The generator then treats that JSON as a schema. Each request entry contains the HTTP method, URL pattern, required headers, and any query or body parameters. The code walks that structure and emits a Python function per request — each one following a consistent pattern: accept an auth object o, construct the full URL from o.base_url, destructure o.headers onto the request headers, and call requests.get() or the appropriate method.
The output isn't production-ready — it's honest scaffolding. The generated functions need massaging: real error handling, response parsing, and endpoint-specific validation. But that's intentional. The generator handles the 80% that's mechanical and identical across every function. You handle the 20% that requires judgment. That's a much better division of labor than writing everything from scratch.
The key design decision worth noting is the shared auth object. Rather than threading credentials through every function signature or relying on global state, each generated function accepts o and destructures what it needs. It's a lightweight pattern that keeps functions composable without coupling them to a specific auth implementation.
The GitHub repo linked below includes the full generator and the Domo-specific Postman collection so you can run it against real endpoints or adapt it for your own API targets.



