Objective & prerequisites
Identify which failures can safely be retried and which need a decision. Prerequisites: basic Python expressions and files; use a disposable local practice folder and fictional data. This shared workshop complements the existing data/AI tracks and does not create a second progress system.
Understand the concept
A retry repeats a request; it can duplicate a side effect if the operation is not idempotent or lacks a reliable idempotency key. Reads and writes require different policies. Use a bounded retry budget, timeouts and an explicit terminal failure. Rate-limit responses and service instructions matter. Do not treat repeated authorization failure as a transient network fault.
Worked example
A fictional GET count response times out once then returns a valid envelope; a bounded retry may be appropriate. A POST payment timeout leaves an unknown outcome and must not be blindly repeated. This learning platform keeps payments disabled and does not send either request.
Try it yourself
Write pseudocode for at most three read attempts with a timeout, retryable failure list and final error. Explain why a malformed schema should fail rather than trigger unbounded retries. Record your prediction before running the supplied reference, then compare the observed result and explain any difference.
Worked solution
The maximum is three total attempts, not three retries plus an initial attempt unless explicitly stated. Validation errors and 401/403 require investigation. A write needs a documented side-effect/idempotency design; a generated random key per retry would defeat deduplication.
Knowledge check
Does a timeout prove a write never happened? Try answering without rereading the example.
Check and explain
No. The server might have completed the operation before the response was lost.
Mini-project, mistakes & handover
Produce a short README with the question, exact local command, input meaning, checks and actual results. Include one failure case and its explanation. Never silently turn an exception into a passing result. Mark simulated behavior explicitly, credit the supplied teaching code and identify your own contribution. These activities are unsaved self-practice, not certification.
Authoritative reference
— consulted for the underlying interface/concept. The lesson and fictional examples are original teaching material. Python reference tested with 3.12; designed for 3.10+. Git lab requires Git 2.28+.
Try the activity before reading its reference. Keep your sources, commands and assumptions with your work. Companion activities are unsaved self-practice and do not award a certificate or change lesson progress.