validate_url

validate_url(url: str) bool[source]

Validates whether a given URL is properly formatted.

This function checks if the URL follows a valid format using a regular expression. It also ensures that the parsed URL contains both a scheme (e.g., "http" or "https") and a network location (netloc), which are required components for a valid URL.

Parameters:

url -- The URL to validate.

Returns:

True if the URL is valid, False otherwise.