import requests for port in [3000, 3001, 34821]: try: r = requests.get(f"http://localhost:{port}", timeout=2) print(f"Port {port}: {r.status_code}") except Exception as e: print(f"Port {port}: failed ({e})")