# Path: jarr/lib/utils.py
# def digest(text, alg='md5', out='str', encoding='utf8'):
#     method = md5 if alg == 'md5' else sha1
#     text = text.encode(encoding) if hasattr(text, 'encode') else text
#     return getattr(method(text), 'hexdigest' if out == 'str' else 'digest')()


import logging
from jarr.lib.utils import digest


logger = logging.getLogger(__name__)


def response_etag_match(feed, resp):
    if feed.etag and resp.headers.get('etag'):
        if feed.etag.startswith('jarr/'):
            return False  # it's a jarr generated etag

# Path: jarr/lib/utils.py
# def digest(text, alg='md5', out='str', encoding='utf8'):
#     method = md5 if alg == 'md5' else sha1
#     text = text.encode(encoding) if hasattr(text, 'encode') else text
#     return getattr(method(text), 'hexdigest' if out == 'str' else 'digest')()


# Path: jarr/crawler/requests_utils.py
import logging
from jarr.lib.utils import digest



logger = logging.getLogger(__name__)


def response_etag_match(feed, resp):
    if feed.etag and resp.headers.get('etag'):
        if feed.etag.startswith('jarr/'):
            return False  # it's a jarr generated etag

        if resp.headers['etag'] == feed.etag: