Scrapy, a fast high-level web crawling & scraping framework for Python.
fix: InvalidNegotiatedProtocol __str__ method
Aditya30eb005639b7
diff --git a/scrapy/core/http2/agent.py b/scrapy/core/http2/agent.pyindex f4ac29bc6..f829cc5f8 100644--- a/scrapy/core/http2/agent.py+++ b/scrapy/core/http2/agent.py@@ -68,7 +68,7 @@ class H2ConnectionPool:# Now as we have established a proper HTTP/2 connection# we fire all the deferred's with the connection instance- pending_requests = self._pending_requests.pop(key)+ pending_requests = self._pending_requests.pop(key, None)while pending_requests:d = pending_requests.popleft()d.callback(conn)diff --git a/scrapy/core/http2/protocol.py b/scrapy/core/http2/protocol.pyindex 7a3156541..c6f00423a 100644--- a/scrapy/core/http2/protocol.py+++ b/scrapy/core/http2/protocol.py@@ -39,7 +39,7 @@ class InvalidNegotiatedProtocol(H2Error):self.negotiated_protocol = negotiated_protocoldef __str__(self) -> str:- return f'InvalidHostname: Expected h2 as negotiated protocol, received {self.negotiated_protocol!r}'+ return f'InvalidNegotiatedProtocol: Expected h2 as negotiated protocol, received {self.negotiated_protocol!r}'class RemoteTerminatedConnection(H2Error):diff --git a/scrapy/core/http2/stream.py b/scrapy/core/http2/stream.pyindex 33302421e..df7470e11 100644--- a/scrapy/core/http2/stream.py+++ b/scrapy/core/http2/stream.py@@ -31,6 +31,9 @@ class InactiveStreamClosed(ConnectionClosed):def __init__(self, request: Request):self.request = request+ def __str__(self) -> str:+ return f'InactiveStreamClosed: Connection was closed without sending the request {self.request!r}'+class InvalidHostname(H2Error):