Proper warning level of deprecation notice (#908)

This enables us to control emitted messages via the PYTHONWARNINGS
environment variable or by -W option.
This commit is contained in:
Nicholas Guriev 2020-04-25 10:42:03 +03:00 committed by GitHub
parent c6872e1fea
commit 97cf9dadd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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