HTML Prettifier

1
2
3
4
5
6
7
8
from BeautifulSoup import BeautifulSoup

class Prettify(object):
    def process_response(self, request, response):
        if response.has_header('Content-Type') and response['Content-Type'].startswith('text/html'):
            response.content = BeautifulSoup(response.content).prettify()
        
        return response

More like this

  1. Prettify HTML body contents in HTTP response by n1k0 1 year, 5 months ago
  2. Prettify HTML5 middleware by runejuhl 10 months, 2 weeks ago
  3. prettify html by marchino 5 years, 1 month ago
  4. DebugFooter middleware by simon 4 years ago
  5. debug info middleware by mzitnik 3 years, 9 months ago

Comments

(Forgotten your password?)