diff --git a/mitmproxy/addons/proxyserver.py b/mitmproxy/addons/proxyserver.py index 806eeb5f9..1e89e2ab2 100644 --- a/mitmproxy/addons/proxyserver.py +++ b/mitmproxy/addons/proxyserver.py @@ -28,7 +28,7 @@ class AsyncReply(controller.Reply): pass # event loop may already be closed. def kill(self, force=False): # pragma: no cover - warnings.warn("reply.kill() is deprecated, set the error attribute instead.", PendingDeprecationWarning, stacklevel=2) + warnings.warn("reply.kill() is deprecated, set the error attribute instead.", DeprecationWarning, stacklevel=2) self.obj.error = flow.Error(Error.KILLED_MESSAGE) diff --git a/mitmproxy/proxy/context.py b/mitmproxy/proxy/context.py index c54615fbc..4f4fc5df6 100644 --- a/mitmproxy/proxy/context.py +++ b/mitmproxy/proxy/context.py @@ -97,7 +97,7 @@ class Connection(serializable.Serializable, metaclass=ABCMeta): @property def alpn_proto_negotiated(self) -> Optional[bytes]: # pragma: no cover - warnings.warn("Server.alpn_proto_negotiated is deprecated, use Server.alpn instead.", PendingDeprecationWarning) + warnings.warn("Server.alpn_proto_negotiated is deprecated, use Server.alpn instead.", DeprecationWarning) return self.alpn @@ -174,22 +174,22 @@ class Client(Connection): @property def address(self): # pragma: no cover - warnings.warn("Client.address is deprecated, use Client.peername instead.", PendingDeprecationWarning, stacklevel=2) + warnings.warn("Client.address is deprecated, use Client.peername instead.", DeprecationWarning, stacklevel=2) return self.peername @address.setter def address(self, x): # pragma: no cover - warnings.warn("Client.address is deprecated, use Client.peername instead.", PendingDeprecationWarning, stacklevel=2) + warnings.warn("Client.address is deprecated, use Client.peername instead.", DeprecationWarning, stacklevel=2) self.peername = x @property def cipher_name(self) -> Optional[str]: # pragma: no cover - warnings.warn("Client.cipher_name is deprecated, use Client.cipher instead.", PendingDeprecationWarning, stacklevel=2) + warnings.warn("Client.cipher_name is deprecated, use Client.cipher instead.", DeprecationWarning, stacklevel=2) return self.cipher @property def clientcert(self) -> Optional[certs.Cert]: # pragma: no cover - warnings.warn("Client.clientcert is deprecated, use Client.certificate_list instead.", PendingDeprecationWarning, stacklevel=2) + warnings.warn("Client.clientcert is deprecated, use Client.certificate_list instead.", DeprecationWarning, stacklevel=2) if self.certificate_list: return self.certificate_list[0] else: @@ -197,7 +197,7 @@ class Client(Connection): @clientcert.setter def clientcert(self, val): # pragma: no cover - warnings.warn("Client.clientcert is deprecated, use Client.certificate_list instead.", PendingDeprecationWarning) + warnings.warn("Client.clientcert is deprecated, use Client.certificate_list instead.", DeprecationWarning) if val: self.certificate_list = [val] else: @@ -278,12 +278,12 @@ class Server(Connection): @property def ip_address(self) -> Optional[Address]: # pragma: no cover - warnings.warn("Server.ip_address is deprecated, use Server.peername instead.", PendingDeprecationWarning, stacklevel=2) + warnings.warn("Server.ip_address is deprecated, use Server.peername instead.", DeprecationWarning, stacklevel=2) return self.peername @property def cert(self) -> Optional[certs.Cert]: # pragma: no cover - warnings.warn("Server.cert is deprecated, use Server.certificate_list instead.", PendingDeprecationWarning, stacklevel=2) + warnings.warn("Server.cert is deprecated, use Server.certificate_list instead.", DeprecationWarning, stacklevel=2) if self.certificate_list: return self.certificate_list[0] else: @@ -291,7 +291,7 @@ class Server(Connection): @cert.setter def cert(self, val): # pragma: no cover - warnings.warn("Server.cert is deprecated, use Server.certificate_list instead.", PendingDeprecationWarning, stacklevel=2) + warnings.warn("Server.cert is deprecated, use Server.certificate_list instead.", DeprecationWarning, stacklevel=2) if val: self.certificate_list = [val] else: diff --git a/mitmproxy/websocket.py b/mitmproxy/websocket.py index 02fd1f5e2..5fe715c83 100644 --- a/mitmproxy/websocket.py +++ b/mitmproxy/websocket.py @@ -48,7 +48,7 @@ class WebSocketMessage(serializable.Serializable): else: return "binary message: {}".format(strutils.bytes_to_escaped_str(self.content)) - def kill(self): + def kill(self): # pragma: no cover """ Kill this message. @@ -56,7 +56,7 @@ class WebSocketMessage(serializable.Serializable): """ warnings.warn( "WebSocketMessage.kill is deprecated, set an empty content instead.", - PendingDeprecationWarning, + DeprecationWarning, stacklevel=2, ) # empty str or empty bytes.