From: Nicholas Guriev Date: Sat, 25 Apr 2020 07:42:03 +0000 (+0300) Subject: Proper warning level of deprecation notice (#908) X-Git-Tag: 0.13.0.dev0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97cf9dadd2c91a27ebc4f9b2738711de3aee25e1;p=thirdparty%2Fhttpx.git Proper warning level of deprecation notice (#908) This enables us to control emitted messages via the PYTHONWARNINGS environment variable or by -W option. --- diff --git a/httpx/_models.py b/httpx/_models.py index aa441afe..ed4f984d 100644 --- a/httpx/_models.py +++ b/httpx/_models.py @@ -876,7 +876,8 @@ class Response: 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 @@ class Response: 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