yield part
self.close()
+ def next(self) -> "Response":
+ """
+ Get the next response from a redirect response.
+ """
+ if not self.is_redirect:
+ raise NotRedirectResponse()
+ assert self.call_next is not None
+ return self.call_next()
+
def close(self) -> None:
"""
Close the response and release the connection.
response = client.get(url, allow_redirects=False)
with pytest.raises(TooManyRedirects):
while response.is_redirect:
- response = response.call_next()
+ response = response.next()
@pytest.mark.usefixtures("async_environment")