import requests

try:
    r = requests.get("https://httpbin.org/status/404", timeout=5)
    r.raise_for_status()   # raises an error for 4xx/5xx responses
except requests.exceptions.HTTPError:
    print("The spell fizzled — page not found.")
except requests.exceptions.RequestException:
    print("No connection. Check Wi-Fi and try again.")
