

def download_content(file_from_path, force=False, real_browser=False):
    url = get_sanitized_url(file_from_path)
    try:
        if (not real_browser):
            file_from = get_file_from(url)
        else:
            file_from = get_file_from_real_browser(url)
        logger.info('Downloading {0}'.format(url))
        content = file_from.read()
        file_from.close()
        encoding = get_encoding(content)
        try:
            content = unicode(content, encoding)
        except Exception:
            content = unicode(content, 'utf8')
        return (content, encoding)
    except Exception:
        logger.exception('Error while downloading a file: {0}'.format(url))
        raise RecoDocError('Error downloading {0}'.format(url))

dataset/ETHPy150Open bartdag/recodoc2/recodoc2/apps/docutil/commands_util.py download_content/original