Exercise 3: Two Independent Real Clients, Two Independent Real Sessions — Possible Solution ==================================================================== THE SETUP ------------------------------ jar_a = http.cookiejar.CookieJar() opener_a = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar_a)) jar_b = http.cookiejar.CookieJar() opener_b = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar_b)) Two completely separate real CookieJar instances, each simulating its own real browser with its own real cookie storage, both talking to the exact same running App instance. VERIFIED, REAL RESULT (interleaved on purpose) ------------------------------ client A: b'You have visited 1 times' client A: b'You have visited 2 times' client A: b'You have visited 3 times' client B: b'You have visited 1 times' client A: b'You have visited 4 times' client B: b'You have visited 2 times' Client A reaches 4 total visits and client B reaches 2, each counting up correctly on its own, real, independent timeline - regardless of the two clients' requests being interleaved rather than run one after the other. WHY THIS WORKS AS AN ANSWER ------------------------------ Each opener holds its own real Set-Cookie response and resends its own real session_id on every later request - opener_a's own cookie and opener_b's own cookie are two genuinely different strings the whole time, so SessionStore.load() looks up two entirely separate dict entries. Interleaving the real requests (A, A, A, B, A, B) rather than running each client's own requests as one uninterrupted block rules out any accidental ordering effect - the two counts stay correctly separate no matter which client's request lands on the server first.