Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

use byte constants for prefix instead of encoding it

Konstantin Lopuhinfd24e22442d9
diff --git a/scrapy/commands/fetch.py b/scrapy/commands/fetch.py
index 49fa18ab2..f09a873c1 100644
--- a/scrapy/commands/fetch.py
+++ b/scrapy/commands/fetch.py
@@ -29,16 +29,15 @@ class Command(ScrapyCommand):
help="print response HTTP headers instead of body")
def _print_headers(self, headers, prefix):
- prefix = prefix.encode()
for key, values in headers.items():
for value in values:
self._print_bytes(prefix + b' ' + key + b': ' + value)
def _print_response(self, response, opts):
if opts.headers:
- self._print_headers(response.request.headers, '>')
+ self._print_headers(response.request.headers, b'>')
print('>')
- self._print_headers(response.headers, '<')
+ self._print_headers(response.headers, b'<')
else:
self._print_bytes(response.body)