]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Proper warning level of deprecation notice (#908)
authorNicholas Guriev <guriev-ns@ya.ru>
Sat, 25 Apr 2020 07:42:03 +0000 (10:42 +0300)
committerGitHub <noreply@github.com>
Sat, 25 Apr 2020 07:42:03 +0000 (09:42 +0200)
This enables us to control emitted messages via the PYTHONWARNINGS
environment variable or by -W option.

httpx/_models.py

index aa441afe33fe3e138fa8fd03e8e827f2eaafe5be..ed4f984d262c391a59ef873e6af89fa1498c61ad 100644 (file)
@@ -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