def follow(self, link): if link.startswith("http://"): return conn = HTTPConnection(WebGuiTest.defaulthost) conn.request("GET", link) response = conn.getresponse() response.read() conn.close() if response.status not in [200, 302, 303, 307]: print("LINK-ERROR:", link, response.status, response.reason) self.errors += 1
def get(self, url, status=200): conn = HTTPConnection(self.defaulthost, timeout=5) conn.request("GET", url) response = conn.getresponse() body = response.read() conn.close() self.assertEqual(response.status, status) try: body = body.decode() except UnicodeDecodeError: pass return body
def get(self, url, status=200): conn = HTTPConnection(self.defaulthost) conn.request("GET", url) response = conn.getresponse() body = response.read() conn.close() self.assertEqual(response.status, status) try: body = body.decode() except UnicodeDecodeError: pass return body
def follow(self, link): if link.startswith('http://'): return conn = HTTPConnection(WebGuiTest.defaulthost) conn.request("GET", link) response = conn.getresponse() body = response.read() conn.close() if response.status not in [200, 302, 303, 307]: sys.stderr.write('\nLINK-ERROR: %s, %d, %s' % (link, response.status, response.reason)) if response.status == 500: sys.stderr.write(body) self.errors += 1