(url: str, etag: str = None)
return filename
Convert `url` into a hashed filename in a repeatable way.
    If `etag` is specified, append its hash to the url's, delimited
    by a period.
Convert `url` into a hashed filename in a repeatable way.
    If `etag` is specified, append its hash to the url's, delimited
    by a period.
Convert url into a hashed filename in a repeatable way . If etag is specified append its hash to the url s delimited by a period .
def url_to_filename(url: str, etag: str = None) -> str:
    """
    Convert `url` into a hashed filename in a repeatable way.
    If `etag` is specified, append its hash to the url's, delimited
    by a period.
    """
    url_bytes = url.encode('utf-8')
    url_hash = sha256(url_bytes)
    filename = url_hash.hexdigest()

    if etag:
        etag_bytes = etag.encode('utf-8')
        etag_hash = sha256(etag_bytes)
        filename += '.' + etag_hash.hexdigest()

    return filename
def url_to_filename ( url : str , etag : str = None ) -> str : url_bytes = url . encode ( 'utf-8' ) url_hash = sha256 ( url_bytes ) filename = url_hash . hexdigest ( ) if etag : etag_bytes = etag . encode ( 'utf-8' ) etag_hash = sha256 ( etag_bytes ) filename += '.' + etag_hash . hexdigest ( ) return filename