Skip to content

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

better deprecation warning for Response.body_as_unicode() (#4579)

Mikhail Korobovbcc40c40771a
diff --git a/scrapy/http/response/text.py b/scrapy/http/response/text.py
index 5614e6e55..0603b6653 100644
--- a/scrapy/http/response/text.py
+++ b/scrapy/http/response/text.py
@@ -65,7 +65,7 @@ class TextResponse(Response):
"""Return body as unicode"""
warnings.warn('Response.body_as_unicode() is deprecated, '
'please use Response.text instead.',
- ScrapyDeprecationWarning)
+ ScrapyDeprecationWarning, stacklevel=2)
return self.text
@property