/ haystack / utils / url_validation.py
url_validation.py
 1  # SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
 2  #
 3  # SPDX-License-Identifier: Apache-2.0
 4  
 5  from urllib.parse import urlparse
 6  
 7  
 8  def is_valid_http_url(url: str) -> bool:
 9      """Check if a URL is a valid HTTP/HTTPS URL."""
10      r = urlparse(url)
11      return all([r.scheme in ["http", "https"], r.netloc])