(response)
Parse ETag header from response if it is set.
Parse ETag header from response if it is set.
Parse ETag header from response if it is set .
def _parse_etag(response):
        """Parse ETag header from response if it is set."""
        value = response.headers.get("ETag")

        if value:
            # 'W/' (case-sensitive) indicates that a weak validator is used,
            # currently ignoring this.
            # Format is string of ASCII characters placed between double quotes
            # but can seemingly also include hyphen characters.
            etag = re.match(r'^(W/)?("[!#-~]+")$', value)
            if etag and len(etag.groups()) == 2:
                return etag.groups()[1]
def _parse_etag ( response ) : value = response . headers . get ( "ETag" ) if value : # 'W/' (case-sensitive) indicates that a weak validator is used, # currently ignoring this. # Format is string of ASCII characters placed between double quotes # but can seemingly also include hyphen characters. etag = re . match ( r'^(W/)?("[!#-~]+")$' , value ) if etag and len ( etag . groups ( ) ) == 2 : return etag . groups ( ) [ 1 ]