From: Tom Christie Date: Wed, 5 Aug 2020 18:10:59 +0000 (+0100) Subject: Deprecate URL.is_ssl (#1128) X-Git-Tag: 0.14.0~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e73be83a8e133521c8c0cd7426a33cda196eef0;p=thirdparty%2Fhttpx.git Deprecate URL.is_ssl (#1128) --- diff --git a/httpx/_models.py b/httpx/_models.py index e8985152..2d75e8f5 100644 --- a/httpx/_models.py +++ b/httpx/_models.py @@ -140,6 +140,8 @@ class URL: @property def is_ssl(self) -> bool: + message = 'URL.is_ssl() is pending deprecation. Use url.scheme == "https"' + warnings.warn(message, DeprecationWarning) return self.scheme == "https" @property diff --git a/tests/client/test_client.py b/tests/client/test_client.py index b05735ea..03f3d788 100644 --- a/tests/client/test_client.py +++ b/tests/client/test_client.py @@ -178,7 +178,8 @@ def test_merge_absolute_url(): client = httpx.Client(base_url="https://www.example.com/") request = client.build_request("GET", "http://www.example.com/") assert request.url == httpx.URL("http://www.example.com/") - assert not request.url.is_ssl + with pytest.warns(DeprecationWarning): + assert not request.url.is_ssl def test_merge_relative_url():