Python Developer Interview Question

How would you build an endpoint that needs data from three slow upstream services?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Call them concurrently rather than in sequence. In an async framework, launch all three with asyncio.gather or a task group so total latency is the slowest call, not the sum. Give every call a timeout, decide which responses are optional so you can degrade instead of failing, and cache what is stable. If the client can tolerate it, return a job id instead.

Why interviewers ask this

This is a systems design question wearing Python clothes. The interviewer wants concurrency instincts, but more than that they want failure thinking: timeouts on every network call, partial degradation, and what the user sees when one dependency is down. Candidates who only answer with gather and stop there have not run anything that depends on services they do not control.

How to structure your answer

  • Turn sequential calls into concurrent ones.
  • Put a timeout on every outbound call.
  • Decide what is optional and degrade gracefully.
  • Add caching or move the work to a background job.

Example answer

Spoken example, first person

Sequentially those three latencies add up, so the first move is running them together. With httpx and an async handler I gather the three coroutines, or use a task group so a failure cancels the siblings cleanly, and the endpoint then costs roughly the slowest upstream instead of the sum. Every call gets an explicit timeout, because the default in most clients is effectively forever and one hung socket will exhaust the worker pool. Then I decide what is essential. If two of the three are decoration, I collect exceptions instead of raising and render the page without them rather than throwing a five hundred, and I emit a metric so we still know it happened. Anything stable gets cached, since even sixty seconds of caching removes most of the load. If the client can tolerate it, the better shape is accepting the request, queueing the work, and returning a job id to poll, which takes the upstream latency off the request path entirely.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What happens if one upstream hangs past your timeout?
  • How do you propagate cancellation through those tasks?
  • Where would you put a circuit breaker?

Related python developer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot