import requests from requests.exceptions import RequestException, Timeout def check_url(url: str, timeout: int = 10, retries: int = 3, verify_ssl: bool = False) -> bool: """ Check if a given URL is reachable. Args: url (str): The URL to check. timeout (int): Timeout for each request in seconds. retries (int): Number of retry attempts before failing. verify_ssl (bool): Verify SSL. Returns: bool: True if the URL is reachable, False otherwise. """ for attempt in range(retries): try: response = requests.head(url, timeout=timeout, allow_redirects=True, verify=verify_ssl) if 200 <= response.status_code < 400: return True except (RequestException, Timeout): continue return False