w3c_validator/validator.py
def validate(filename, verbose=False):
    """
    Validate file and return JSON result as dictionary.

    "filename" can be a file name or an HTTP URL.
    Return "" if the validator does not return valid JSON.
    Raise OSError if curl command returns an error status.
    """
    # is_css = filename.endswith(".css")

    is_remote = filename.startswith("http://") or filename.startswith(
        "https://")
    with BytesIO(requests.get(filename, verify=False).content) if is_remote else open(
            filename, "rb") as f:

        # if is_css:
        #     cmd = (
        #         "curl -sF \"file=@%s;type=text/css\" -F output=json -F warning=0 %s"
        #         % (quoted_filename, CSS_VALIDATOR_URL))
        #     _ = cmd
        # else:
        resp = requests.post(
            HTML_VALIDATOR_URL,
            files={"file": (filename, f, "text/html")},
            data={
                "out": "json",
                "showsource": "yes",
            },
            verify=False)

    return resp.json()

    Validate file and return JSON result as dictionary.

    "filename" can be a file name or an HTTP URL.
    Return "" if the validator does not return valid JSON.
    Raise OSError if curl command returns an error status.
    
Validate file and return JSON result as dictionary.
"filename" can be a file name or an HTTP URL.
Return "" if the validator does not return valid JSON.
Raise OSError if curl command returns an error status.
Validate file and return JSON result as dictionary . " filename " can be a file name or an HTTP URL . Return " " if the validator does not return valid JSON . Raise OSError if curl command returns an error status .
def validate(filename, verbose=False):
    is_remote = filename.startswith("http://") or filename.startswith(
        "https://")
    with BytesIO(requests.get(filename, verify=False).content) if is_remote else open(
            filename, "rb") as f:
        resp = requests.post(
            HTML_VALIDATOR_URL,
            files={"file": (filename, f, "text/html")},
            data={
                "out": "json",
                "showsource": "yes",
            },
            verify=False)
    return resp.json()
def validate ( filename , verbose = False ) : is_remote = filename . startswith ( "http://" ) or filename . startswith ( "https://" ) with BytesIO ( requests . get ( filename , verify = False ) . content ) if is_remote else open ( filename , "rb" ) as f : resp = requests . post ( HTML_VALIDATOR_URL , files = { "file" : ( filename , f , "text/html" ) } , data = { "out" : "json" , "showsource" : "yes" , } , verify = False ) return resp . json ( )
Validate file and return JSON result as dictionary.
Validate file and return JSON result as dictionary .
"""
    Validate file and return JSON result as dictionary.

    "filename" can be a file name or an HTTP URL.
    Return "" if the validator does not return valid JSON.
    Raise OSError if curl command returns an error status.
    """ # is_css = filename.endswith(".css") # if is_css: #     cmd = ( #         "curl -sF \"file=@%s;type=text/css\" -F output=json -F warning=0 %s" #         % (quoted_filename, CSS_VALIDATOR_URL)) #     _ = cmd # else:
filename
verbose