(url)
return url
Add http as the default scheme if it is missing from the url.
Add http as the default scheme if it is missing from the url.
Add http as the default scheme if it is missing from the url .
def add_http_if_no_scheme(url):
    """Add http as the default scheme if it is missing from the url."""
    match = re.match(r"^\w+://", url, flags=re.I)
    if not match:
        parts = urlparse(url)
        scheme = "http:" if parts.netloc else "http://"
        url = scheme + url

    return url
def add_http_if_no_scheme ( url ) : match = re . match ( r"^\w+://" , url , flags = re . I ) if not match : parts = urlparse ( url ) scheme = "http:" if parts . netloc else "http://" url = scheme + url return url