

def process_response(self, request, response):
    if (response.status_code != 200):
        return response
    content_type = response.get('Content-Type', '').split(';')[0].strip().lower()
    if (content_type not in ['text/html', 'application/xhtml+xml']):
        return response
    soup = BeautifulSoup(smart_str(response.content), 'html.parser')
    if (not getattr(soup, 'head', None)):
        return response
    script = soup.new_tag('script', src='http://localhost:35729/livereload.js')
    soup.head.append(script)
    response.content = str(soup)
    return response

dataset/ETHPy150Open Fantomas42/django-livereload/livereload/middleware.py LiveReloadScript.process_response/original