Skip to content

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

Remove Python 2 code from WrappedRequest

Laerte Pereirabefb6df11905
diff --git a/scrapy/http/cookies.py b/scrapy/http/cookies.py
index bf4ae7b45..b43c383fe 100644
--- a/scrapy/http/cookies.py
+++ b/scrapy/http/cookies.py
@@ -142,10 +142,6 @@ class WrappedRequest:
"""
return self.request.meta.get('is_unverifiable', False)
- def get_origin_req_host(self):
- return urlparse_cached(self.request).hostname
-
- # python3 uses attributes instead of methods
@property
def full_url(self):
return self.get_full_url()
@@ -164,7 +160,7 @@ class WrappedRequest:
@property
def origin_req_host(self):
- return self.get_origin_req_host()
+ return urlparse_cached(self.request).hostname
def has_header(self, name):
return name in self.request.headers
diff --git a/tests/test_http_cookies.py b/tests/test_http_cookies.py
index 540e27907..08420332c 100644
--- a/tests/test_http_cookies.py
+++ b/tests/test_http_cookies.py
@@ -34,7 +34,6 @@ class WrappedRequestTest(TestCase):
self.assertTrue(self.wrapped.unverifiable)
def test_get_origin_req_host(self):
- self.assertEqual(self.wrapped.get_origin_req_host(), 'www.example.com')
self.assertEqual(self.wrapped.origin_req_host, 'www.example.com')
def test_has_header(self):