def is_root_document(entry):
    '''
    guesses whether the entry is from the root document of a web page
    '''
    # guess based on media type
    if entry.response:  # might be None
        mt = entry.response.mediaType
        if mt.type == 'text':
            if mt.subtype in ['html', 'xhtml', 'xml']:
                # probably...
                return True
    # else, guess by request url?
    return False
dataset/ETHPy150Open andrewf/pcap2har/pcap2har/pagetracker.py/is_root_document/original