From: Florimond Manca Date: Sun, 29 Dec 2019 15:34:07 +0000 (+0100) Subject: Rename 'next' to 'anext' on Response (#676) X-Git-Tag: 0.10.0~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3462999366e01dcbc1db58ee9634093931bc9dbe;p=thirdparty%2Fhttpx.git Rename 'next' to 'anext' on Response (#676) * Rename 'next' to 'anext' on Response * Drop iscoroutinefunction() check Co-authored-by: Tom Christie --- diff --git a/docs/api.md b/docs/api.md index 06126b00..3b28fb38 100644 --- a/docs/api.md +++ b/docs/api.md @@ -68,7 +68,7 @@ * `def .aiter_text()` - **async text iterator** * `def .aiter_lines()` - **async text iterator** * `def .aclose()` - **None** -* `def .next()` - **Response** +* `def .anext()` - **Response** ## `Request` diff --git a/httpx/models.py b/httpx/models.py index 17410951..8b219d32 100644 --- a/httpx/models.py +++ b/httpx/models.py @@ -916,7 +916,7 @@ class Response: yield part await self.aclose() - async def next(self) -> "Response": + async def anext(self) -> "Response": """ Get the next response from a redirect response. """ diff --git a/tests/client/test_redirects.py b/tests/client/test_redirects.py index 49209888..8ad81fee 100644 --- a/tests/client/test_redirects.py +++ b/tests/client/test_redirects.py @@ -110,7 +110,7 @@ async def test_no_redirect(): response = await client.get(url) assert response.status_code == 200 with pytest.raises(NotRedirectResponse): - await response.next() + await response.anext() @pytest.mark.usefixtures("async_environment") @@ -151,7 +151,7 @@ async def test_disallow_redirects(): assert response.is_redirect is True assert len(response.history) == 0 - response = await response.next() + response = await response.anext() assert response.status_code == codes.OK assert response.url == URL("https://example.org/") assert response.is_redirect is False @@ -216,7 +216,7 @@ async def test_too_many_redirects_calling_next(): response = await client.get(url, allow_redirects=False) with pytest.raises(TooManyRedirects): while response.is_redirect: - response = await response.next() + response = await response.anext() @pytest.mark.usefixtures("async_environment") @@ -233,7 +233,7 @@ async def test_redirect_loop_calling_next(): response = await client.get(url, allow_redirects=False) with pytest.raises(RedirectLoop): while response.is_redirect: - response = await response.next() + response = await response.anext() @pytest.mark.usefixtures("async_environment")