def _is_valid_url ( url ) : try : parsed = urlparse ( url ) mandatory_parts = [ parsed . scheme , parsed . netloc ] return all ( mandatory_parts ) except : return False
check if domain is valid python
Helper function to validate that URLs are well formed i . e that it contains a valid protocol and a valid domain . It does not actually check if the URL exists
def _is_valid_url(url):
        """ Helper function to validate that URLs are well formed, i.e that it contains a valid
            protocol and a valid domain. It does not actually check if the URL exists
        """
        try:
            parsed = urlparse(url)
            mandatory_parts = [parsed.scheme, parsed.netloc]
            return all(mandatory_parts)
        except:
            return False