Skip to content

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

Merge branch 'master' into master

Adrián Chavese7d3fad00eab
diff --cc scrapy/http/request/__init__.py
index a1857c604,7672dec00..305eef918
--- a/scrapy/http/request/__init__.py
+++ b/scrapy/http/request/__init__.py
@@@ -106,17 -118,18 +118,16 @@@ class Request(object_ref)
body = property(_get_body, obsolete_setter(_set_body, 'body'))
@property
- def encoding(self):
+ def encoding(self) -> str:
return self._encoding
- def __str__(self) -> str:
+ def __repr__(self):
return f"<{self.method} {self.url}>"
- def copy(self):
- """Return a copy of this Request"""
- __repr__ = __str__
-
+ def copy(self) -> "Request":
return self.replace()
- def replace(self, *args, **kwargs):
+ def replace(self, *args, **kwargs) -> "Request":
"""Create a new Request with the same attributes except for those given new values"""
for x in self.attributes:
kwargs.setdefault(x, getattr(self, x))