Code Room
Code reviewMedium
Question
Review this Python helper that decides whether a webhook event has expired (events are valid for 5 minutes).
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
from datetime import datetime, timedelta, timezone MAX_AGE = timedelta(minutes=5) def is_expired(event): # event['created'] is an ISO-8601 string with offset, e.g. '2026-06-22T19:05:00+00:00' created = datetime.fromisoformat(event['created']) return datetime.now() - created > MAX_AGERun or narrate your approach, then ask the coach.