Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example: As mentioned above, the python requests library fails to fetch certain pages with error: java.util.zip.DataFormatException: invalid stored block lengths

...

Code Block
languagepy
title\[dspace\]/webapps-jython/err_example.py
# -*- coding: utf-8 -*-

from javax.servlet.http import HttpServlet
import requests


class err_example(HttpServlet):
    def doGet(self, request, response):
        response.setContentType("text/plain")
        toClient = response.getWriter()
        toClient.println("BEGIN")
        try:
            r = requests.get('https://demo.dspace.org/xmlui/')  # errors out on certain gzipped pages; see https://github.com/madler/zlib/issues/82
        except:
            import sys, traceback
            traceback.print_exc(file=sys.stdout)  # log to catalina.out
            traceback.print_exc(file=toClient)  # log to HTML output
        toClient.println("END")

See also

...