From 2fb044ced0995dac6ed0d52c31cf6c945e7d0e5a Mon Sep 17 00:00:00 2001 From: Nicholas Guriev Date: Sat, 25 Apr 2020 09:40:41 +0300 Subject: [PATCH] Proper warning level of deprecation notice This enables us to control emitted messages via the PYTHONWARNINGS environment variable or by -W option. --- httpx/_models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/httpx/_models.py b/httpx/_models.py index aa441afe33..ed4f984d26 100644 --- a/httpx/_models.py +++ b/httpx/_models.py @@ -876,7 +876,8 @@ def __repr__(self) -> str: def stream(self): # type: ignore warnings.warn( # pragma: nocover "Response.stream() is due to be deprecated. " - "Use Response.aiter_bytes() instead." + "Use Response.aiter_bytes() instead.", + DeprecationWarning, ) return self.aiter_bytes # pragma: nocover @@ -884,7 +885,8 @@ def stream(self): # type: ignore def raw(self): # type: ignore warnings.warn( # pragma: nocover "Response.raw() is due to be deprecated. " - "Use Response.aiter_raw() instead." + "Use Response.aiter_raw() instead.", + DeprecationWarning, ) return self.aiter_raw # pragma: nocover