Scrapy, a fast high-level web crawling & scraping framework for Python.
response_httprepr: fixed error with unknown response codes (closes #169)
Pablo Hoffman22555df56a90
diff --git a/scrapy/tests/test_utils_response.py b/scrapy/tests/test_utils_response.pyindex 3b2b2226f..231969f0a 100644--- a/scrapy/tests/test_utils_response.py+++ b/scrapy/tests/test_utils_response.py@@ -129,6 +129,9 @@ class ResponseUtilsTest(unittest.TestCase):r1 = Response("http://www.example.com", status=404, headers={"Content-type": "text/html"}, body="Some body")self.assertEqual(response_httprepr(r1), 'HTTP/1.1 404 Not Found\r\nContent-Type: text/html\r\n\r\nSome body')+ r1 = Response("http://www.example.com", status=6666, headers={"Content-type": "text/html"}, body="Some body")+ self.assertEqual(response_httprepr(r1), 'HTTP/1.1 6666 \r\nContent-Type: text/html\r\n\r\nSome body')+def test_get_cached_beautifulsoup(self):r1 = Response('http://www.example.com', body='')diff --git a/scrapy/utils/response.py b/scrapy/utils/response.pyindex 95ae3df32..a691d8875 100644--- a/scrapy/utils/response.py+++ b/scrapy/utils/response.py@@ -85,7 +85,7 @@ def response_httprepr(response):that was received (that's not exposed by Twisted)."""- s = "HTTP/1.1 %d %s\r\n" % (response.status, RESPONSES[response.status])+ s = "HTTP/1.1 %d %s\r\n" % (response.status, RESPONSES.get(response.status, ''))if response.headers:s += response.headers.to_string() + "\r\n"s += "\r\n"