def get_url(m, url, title=False):
    """Request a given URL, handling any errors. If 'title' is True, this will only return the
    first 1000 bytes of the page in an effort to not load too much more than is necessary."""
    request = Request(url, headers=m.bot.header)
    try:
        html = urlopen(request)
    except URLError as e:
        m.bot.logger.info("{0}: {1}".format(url, e.reason))
        return None
    else:
        try:
            bytes = html.read(5000 if title else -1).decode('utf-8')
        except __HOLE__ as e:
            m.bot.logger.info("{0}: {1}".format(url, e.reason))
            return None
        else:
            return bytes
dataset/ETHPy150Open molly/GorillaBot/gorillabot/plugins/util.py/get_url