From 62d56a08760741060a2ec513d2771d001c0f8af4 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 24 Jul 2020 12:30:20 +0100 Subject: [PATCH 1/9] Version 0.14.0 --- CHANGELOG.md | 52 ++++++++++++++++++++++++++++++++++++++++++++ httpx/__version__.py | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a9f24740c..d07c102cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,58 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 0.14.0 + +The most notable feature of the 0.14.0 release is that it tightens up the public +API for `httpx`, by ensuring that several internal attributes and methods become +strictly private. + +The following previously had nominally public names on the client, but were +all undocumented and intended solely for internal usage. They are all now +replaced with underscored names, and should not be relied on or accessed. + +These changes should not affect users who have been working from the `httpx` +documentation. + +* `.merge_url()`, `.merge_headers()`, `.merge_cookies()`, `.merge_queryparams()` +* `.build_auth()`, `.build_redirect_request()` +* `.redirect_method()`, `.redirect_url()`, `.redirect_headers()`, `.redirect_stream()` +* `.send_handling_redirects()`, `.send_handling_auth()`, `.send_single_request()` +* `.init_transport()`, `.init_proxy_transport()` +* `.proxies`, `.transport`, `.netrc`, `.get_proxy_map()` + +See pull requests #997, #1065, #1071. + +Some areas of API which were already on the deprecation path, and were raising warnings or errors in 0.13.x +have now been escalated to being fully removed. + +* Drop `ASGIDispatch`, `WSGIDispatch`, which have been replaced by `ASGITransport`, `WSGITransport`. +* Drop `dispatch=...`` on client, which has been replaced by `transport=...`` +* Drop `soft_limit`, `hard_limit`, which have been replaced by `max_keepalive` and `max_connections`. +* Drop `Response.stream` and` `Response.raw`, which have been replaced by ``.aiter_bytes` and `.aiter_raw`. +* Drop `proxies=` in favor of `proxies=httpx.Proxy(...)`. + +See pull requests #1057, #1058. + +### Added + +* Added dedicated exception class `httpx.HTTPStatusError` for `.raise_for_status()` exceptions. (Pull #1072) +* Support `QueryParams(None)` and `client.params = None`. (Pull #1060) + +### Changed + +* `URL.port` becomes `Optional[int]`. Now only returns a port if one is explicitly included in the URL string. (Pull #1080) +* The `URL(..., allow_relative=[bool])` parameter no longer exists. All URL instances may be relative. (Pull #1073) +* Drop unnecessary `url.full_path = ...` property setter. (Pull #1069) + +### Fixed + +* Add missing `Response.next()` method. (Pull #1055) +* Ensure all exception classes are exposed as public API. (Pull #1045) +* Support multiple items with an identical field name in multipart encodings. (Pull #777) +* Skip HSTS preloading on single-label domains. (Pull #1074) +* Fixes for `Response.iter_lines()`. (Pull #1033, #1075) + ## 0.13.3 (May 29th, 2020) ### Fixed diff --git a/httpx/__version__.py b/httpx/__version__.py index a1f0ef1407..88ba13a8ce 100644 --- a/httpx/__version__.py +++ b/httpx/__version__.py @@ -1,3 +1,3 @@ __title__ = "httpx" __description__ = "A next generation HTTP client, for Python 3." -__version__ = "0.13.3" +__version__ = "0.14.0" From 70293ae343f145d11e167675b90b70f6a5b2f5c5 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 3 Aug 2020 14:19:32 +0100 Subject: [PATCH 2/9] Update CHANGELOG --- CHANGELOG.md | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d07c102cd5..1272b61539 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## 0.14.0 -The most notable feature of the 0.14.0 release is that it tightens up the public -API for `httpx`, by ensuring that several internal attributes and methods become -strictly private. +The 0.14 release includes a range of improvements to the public API, intended +on preparing for our upcoming 1.0 release. + +When upgrading you should be aware of the following public API changes. Note +that deprecated usages will currently continue to function, but will issue +warnings. + +* You should now use `httpx.codes` consistently in favour of `httpx.StatusCodes`. +* Usage of `httpx.Timeout()` should now always include an explicit default. Eg. `httpx.Timeout(None, pool=5.0)`. +* When using `httpx.Timeout()`, we now have more concisely named keyword arguments. Eg. `read=5.0`, instead of `read_timeout=5.0`. +* Use `httpx.Limits()` instead of `httpx.PoolLimits()`, and `limits=...` instead of `pool_limits=...`. +* The multidict methods `Headers.getlist` and `QueryParams.getlist` are deprecated in favour of more consistent `.get_list()` variants. + +One notable aspect of the 0.14.0 release is that it tightens up the public +API for `httpx`, by ensuring that several internal attributes and methods have +now become strictly private. The following previously had nominally public names on the client, but were all undocumented and intended solely for internal usage. They are all now @@ -40,10 +53,17 @@ See pull requests #1057, #1058. ### Added * Added dedicated exception class `httpx.HTTPStatusError` for `.raise_for_status()` exceptions. (Pull #1072) +* Added `httpx.create_ssl_context()` helper function. (Pull #996) +* Support for proxy exlcusions like `proxies={"https://www.example.com": None}`. (Pull #1099) * Support `QueryParams(None)` and `client.params = None`. (Pull #1060) ### Changed +* Use `httpx.codes` consistently in favour of `httpx.StatusCodes` which is placed into deprecation. (Pull #1088) +* Usage of `httpx.Timeout()` should now always include an explicit default. Eg. `httpx.Timeout(None, pool=5.0)`. (Pull #1085) +* Switch to more concise `httpx.Timeout()` keyword arguments. Eg. `read=5.0`, instead of `read_timeout=5.0`. (Pull #1111) +* Use `httpx.Limits()` instead of `httpx.PoolLimits()`, and `limits=...` instead of `pool_limits=...`. (Pull #1113) +* The multidict methods `Headers.getlist` and `QueryParams.getlist` are deprecated in favour of more consistent `.get_list()` variants. (Pull #1089) * `URL.port` becomes `Optional[int]`. Now only returns a port if one is explicitly included in the URL string. (Pull #1080) * The `URL(..., allow_relative=[bool])` parameter no longer exists. All URL instances may be relative. (Pull #1073) * Drop unnecessary `url.full_path = ...` property setter. (Pull #1069) @@ -55,6 +75,11 @@ See pull requests #1057, #1058. * Support multiple items with an identical field name in multipart encodings. (Pull #777) * Skip HSTS preloading on single-label domains. (Pull #1074) * Fixes for `Response.iter_lines()`. (Pull #1033, #1075) +* Ignore permission errors when accessing `.netrc` files. (Pull #1104) +* Allow bare hostnames in `HTTP_PROXY` etc... environment variables. (Pull #1120) +* Settings `app=...` or `transport=...` bypasses any environment based proxy defaults. (Pull #1122) + +--- ## 0.13.3 (May 29th, 2020) @@ -172,6 +197,8 @@ It also means we've had to remove our UDS support, since maintaining that would * Dropped support for `Client(uds=...)` (Pull #804) +--- + ## 0.12.1 (March 19th, 2020) ### Fixed @@ -205,6 +232,8 @@ All imports of `httpx` should import from the top-level package only, such as `f * Support custom `cert` parameters even if `verify=False`. (Pull #796) * Don't support invalid dict-of-dicts form data in `data=...`. (Pull #811) +--- + ## 0.11.1 (January 17th, 2020) ### Fixed @@ -243,6 +272,8 @@ We believe the API is now pretty much stable, and are aiming for a 1.0 release s - Redirect loop detection matches against `(method, url)` rather than `url`. (Pull #734) +--- + ## 0.10.1 (December 31st, 2019) ### Fixed @@ -276,6 +307,8 @@ If following redirects explicitly the `response.next()` method becomes `response - When using a client instance, the per-request usage of `verify`, `cert`, and `trust_env` have now escalated from raising a warning to raising an error. You should set these arguments on the client instead. (Pull #617) - Removed the undocumented `request.read()`, since end users should not require it. +--- + ## 0.9.5 (December 20th, 2019) ### Fixed @@ -347,12 +380,16 @@ importing modules within the package. - Pool timeouts are now on the timeout configuration, not the pool limits configuration. (Pull #563) - The timeout configuration is now named `httpx.Timeout(...)`, not `httpx.TimeoutConfig(...)`. The old version currently remains as a synonym for backwards compatability. (Pull #591) +--- + ## 0.8.0 (November 27, 2019) ### Removed - The synchronous API has been removed, in order to allow us to fundamentally change how we approach supporting both sync and async variants. (See #588 for more details.) +--- + ## 0.7.8 (November 17, 2019) ### Added @@ -475,6 +512,8 @@ importing modules within the package. - Remove deprecated TLS versions (TLSv1 and TLSv1.1) from default `SSLConfig`. (Pull #155) - Fix `URL.join(...)` to work similarly to RFC 3986 URL joining. (Pull #144) +--- + ## 0.6.8 (July 25, 2019) - Check for disconnections when searching for an available From 8515f16591db3a5e367f17289653032c797cb002 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 6 Aug 2020 12:27:28 +0100 Subject: [PATCH 3/9] Update CHANGELOG.md Co-authored-by: Stephen Brown II --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1272b61539..3d446ed623 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ warnings. * Usage of `httpx.Timeout()` should now always include an explicit default. Eg. `httpx.Timeout(None, pool=5.0)`. * When using `httpx.Timeout()`, we now have more concisely named keyword arguments. Eg. `read=5.0`, instead of `read_timeout=5.0`. * Use `httpx.Limits()` instead of `httpx.PoolLimits()`, and `limits=...` instead of `pool_limits=...`. -* The multidict methods `Headers.getlist` and `QueryParams.getlist` are deprecated in favour of more consistent `.get_list()` variants. +* The multidict methods `Headers.getlist()` and `QueryParams.getlist()` are deprecated in favour of more consistent `.get_list()` variants. One notable aspect of the 0.14.0 release is that it tightens up the public API for `httpx`, by ensuring that several internal attributes and methods have From 37f1164457ada0bf3b44bfb3cdad209ad2b2275d Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 6 Aug 2020 14:13:17 +0100 Subject: [PATCH 4/9] Update CHANGELOG --- CHANGELOG.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d446ed623..e7604aba78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,29 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## 0.14.0 -The 0.14 release includes a range of improvements to the public API, intended -on preparing for our upcoming 1.0 release. +The 0.14 release includes a range of improvements to the public API, intended on preparing for our upcoming 1.0 release. -When upgrading you should be aware of the following public API changes. Note -that deprecated usages will currently continue to function, but will issue -warnings. +* Our HSTS support has now been removed. Rewriting URLs from `http` to `https` if the host is on the HSTS list can be beneficial in avoiding roundtrips to incorrectly formed URLs, but on balance we've decided to remove this feature, on the principle of least surprise. Most programmatic clients do not include HSTS support, and for now we're opting to remove our support for it. +* Our exception hierarchy has been overhauled. Most users will want to stick with their existing `httpx.HTTPError` usage, but we've got a clearer overall structure now. See https://www.python-httpx.org/exceptions/ for more details. + +When upgrading you should be aware of the following public API changes. Note that deprecated usages will currently continue to function, but will issue warnings. * You should now use `httpx.codes` consistently in favour of `httpx.StatusCodes`. * Usage of `httpx.Timeout()` should now always include an explicit default. Eg. `httpx.Timeout(None, pool=5.0)`. * When using `httpx.Timeout()`, we now have more concisely named keyword arguments. Eg. `read=5.0`, instead of `read_timeout=5.0`. * Use `httpx.Limits()` instead of `httpx.PoolLimits()`, and `limits=...` instead of `pool_limits=...`. +* Keys used with `Client(proxies={...})` should now be in the style of `{"http://": ...}`, rather than `{"http": ...}`. * The multidict methods `Headers.getlist()` and `QueryParams.getlist()` are deprecated in favour of more consistent `.get_list()` variants. +* The `URL.is_ssl` property is deprecated in favour of `URL.scheme == "https"`. +* The `URL.join(relative_url=...)` method is now `URL.join(url=...)`. This change does not support warnings for the deprecated usage style. -One notable aspect of the 0.14.0 release is that it tightens up the public -API for `httpx`, by ensuring that several internal attributes and methods have -now become strictly private. +One notable aspect of the 0.14.0 release is that it tightens up the public API for `httpx`, by ensuring that several internal attributes and methods have now become strictly private. -The following previously had nominally public names on the client, but were -all undocumented and intended solely for internal usage. They are all now -replaced with underscored names, and should not be relied on or accessed. +The following previously had nominally public names on the client, but were all undocumented and intended solely for internal usage. They are all now replaced with underscored names, and should not be relied on or accessed. -These changes should not affect users who have been working from the `httpx` -documentation. +These changes should not affect users who have been working from the `httpx` documentation. * `.merge_url()`, `.merge_headers()`, `.merge_cookies()`, `.merge_queryparams()` * `.build_auth()`, `.build_redirect_request()` @@ -39,8 +37,7 @@ documentation. See pull requests #997, #1065, #1071. -Some areas of API which were already on the deprecation path, and were raising warnings or errors in 0.13.x -have now been escalated to being fully removed. +Some areas of API which were already on the deprecation path, and were raising warnings or errors in 0.13.x have now been escalated to being fully removed. * Drop `ASGIDispatch`, `WSGIDispatch`, which have been replaced by `ASGITransport`, `WSGITransport`. * Drop `dispatch=...`` on client, which has been replaced by `transport=...`` @@ -63,10 +60,13 @@ See pull requests #1057, #1058. * Usage of `httpx.Timeout()` should now always include an explicit default. Eg. `httpx.Timeout(None, pool=5.0)`. (Pull #1085) * Switch to more concise `httpx.Timeout()` keyword arguments. Eg. `read=5.0`, instead of `read_timeout=5.0`. (Pull #1111) * Use `httpx.Limits()` instead of `httpx.PoolLimits()`, and `limits=...` instead of `pool_limits=...`. (Pull #1113) +* Keys used with `Client(proxies={...})` should now be in the style of `{"http://": ...}`, rather than `{"http": ...}`. (Pull #1127) * The multidict methods `Headers.getlist` and `QueryParams.getlist` are deprecated in favour of more consistent `.get_list()` variants. (Pull #1089) * `URL.port` becomes `Optional[int]`. Now only returns a port if one is explicitly included in the URL string. (Pull #1080) * The `URL(..., allow_relative=[bool])` parameter no longer exists. All URL instances may be relative. (Pull #1073) * Drop unnecessary `url.full_path = ...` property setter. (Pull #1069) +* The `URL.join(relative_url=...)` method is now `URL.join(url=...)`. (Pull #1129) +* The `URL.is_ssl` property is deprecated in favour of `URL.scheme == "https"`. (Pull #1128) ### Fixed @@ -78,6 +78,7 @@ See pull requests #1057, #1058. * Ignore permission errors when accessing `.netrc` files. (Pull #1104) * Allow bare hostnames in `HTTP_PROXY` etc... environment variables. (Pull #1120) * Settings `app=...` or `transport=...` bypasses any environment based proxy defaults. (Pull #1122) +* Fix handling of `.base_url` when a path component is included in the base URL. (Pull #1130) --- From 040961df6a5377965b24d31113937befbc89202a Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 7 Aug 2020 14:22:16 +0100 Subject: [PATCH 5/9] max_keepalive_connections --- CHANGELOG.md | 1 + httpx/_config.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7604aba78..29502bb7e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ When upgrading you should be aware of the following public API changes. Note tha * Usage of `httpx.Timeout()` should now always include an explicit default. Eg. `httpx.Timeout(None, pool=5.0)`. * When using `httpx.Timeout()`, we now have more concisely named keyword arguments. Eg. `read=5.0`, instead of `read_timeout=5.0`. * Use `httpx.Limits()` instead of `httpx.PoolLimits()`, and `limits=...` instead of `pool_limits=...`. +* The `httpx.Limits(max_keepalive=...)` argument is now deprecated in favour of a more explicit `httpx.Limits(max_keepalive_connections=...)`. * Keys used with `Client(proxies={...})` should now be in the style of `{"http://": ...}`, rather than `{"http": ...}`. * The multidict methods `Headers.getlist()` and `QueryParams.getlist()` are deprecated in favour of more consistent `.get_list()` variants. * The `URL.is_ssl` property is deprecated in favour of `URL.scheme == "https"`. diff --git a/httpx/_config.py b/httpx/_config.py index 37bb75a6e2..4284a329f9 100644 --- a/httpx/_config.py +++ b/httpx/_config.py @@ -411,5 +411,5 @@ def __repr__(self) -> str: DEFAULT_TIMEOUT_CONFIG = Timeout(timeout=5.0) -DEFAULT_LIMITS = Limits(max_keepalive=10, max_connections=100) +DEFAULT_LIMITS = Limits(max_connections=100, max_keepalive_connections=20) DEFAULT_MAX_REDIRECTS = 20 From bed8766ba6a658cffaedb0db97083eb7293b2670 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 7 Aug 2020 14:26:42 +0100 Subject: [PATCH 6/9] Add deprecation test --- tests/test_config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_config.py b/tests/test_config.py index d3d391e20c..5c68badba3 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -115,6 +115,11 @@ def test_pool_limits_deprecated(): httpx.PoolLimits() +def test_max_keepalive_deprecated(): + with pytest.warns(DeprecationWarning): + httpx.Limits(max_keepalive=50) + + def test_timeout_eq(): timeout = httpx.Timeout(timeout=5.0) assert timeout == httpx.Timeout(timeout=5.0) From 889bbda6b4ec67a644c6f0f912cbbcb77f898b1b Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 7 Aug 2020 15:18:54 +0100 Subject: [PATCH 7/9] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29502bb7e5..9ea3bfc6c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## 0.14.0 +## 0.14.0 (August 7th, 2020) The 0.14 release includes a range of improvements to the public API, intended on preparing for our upcoming 1.0 release. +* Our HTTP/2 support is now fully optional. **You now need to use `pip install httpx[http2]` if you want to include the HTTP/2 dependancies.** * Our HSTS support has now been removed. Rewriting URLs from `http` to `https` if the host is on the HSTS list can be beneficial in avoiding roundtrips to incorrectly formed URLs, but on balance we've decided to remove this feature, on the principle of least surprise. Most programmatic clients do not include HSTS support, and for now we're opting to remove our support for it. * Our exception hierarchy has been overhauled. Most users will want to stick with their existing `httpx.HTTPError` usage, but we've got a clearer overall structure now. See https://www.python-httpx.org/exceptions/ for more details. From 477c4bd1f80b9ad743a8154d0a1257d111ac2b37 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 7 Aug 2020 15:25:10 +0100 Subject: [PATCH 8/9] Undate dependency pin callout --- README.md | 2 +- docs/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b84214d5cd..b8b51f704c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2. **Note**: _HTTPX should be considered in beta. We believe we've got the public API to -a stable point now, but would strongly recommend pinning your dependencies to the `0.13.*` +a stable point now, but would strongly recommend pinning your dependencies to the `0.14.*` release, so that you're able to properly review [API changes between package updates](https://github.com/encode/httpx/blob/master/CHANGELOG.md). A 1.0 release is expected to be issued sometime around mid-2020._ --- diff --git a/docs/index.md b/docs/index.md index 38721f89a1..e4fa0e5807 100644 --- a/docs/index.md +++ b/docs/index.md @@ -27,7 +27,7 @@ HTTPX is a fully featured HTTP client for Python 3, which provides sync and asyn !!! note HTTPX should currently be considered in beta. - We believe we've got the public API to a stable point now, but would strongly recommend pinning your dependencies to the `0.13.*` release, so that you're able to properly review [API changes between package updates](https://github.com/encode/httpx/blob/master/CHANGELOG.md). + We believe we've got the public API to a stable point now, but would strongly recommend pinning your dependencies to the `0.14.*` release, so that you're able to properly review [API changes between package updates](https://github.com/encode/httpx/blob/master/CHANGELOG.md). A 1.0 release is expected to be issued sometime around mid-2020. From b3a1f5439cac96d50bc0b36e83b3966167b70036 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 7 Aug 2020 15:26:55 +0100 Subject: [PATCH 9/9] Update expected 1.0 release date --- README.md | 2 +- docs/index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b8b51f704c..6f90f674a3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ HTTPX is a fully featured HTTP client for Python 3, which provides sync and asyn **Note**: _HTTPX should be considered in beta. We believe we've got the public API to a stable point now, but would strongly recommend pinning your dependencies to the `0.14.*` -release, so that you're able to properly review [API changes between package updates](https://github.com/encode/httpx/blob/master/CHANGELOG.md). A 1.0 release is expected to be issued sometime around mid-2020._ +release, so that you're able to properly review [API changes between package updates](https://github.com/encode/httpx/blob/master/CHANGELOG.md). A 1.0 release is expected to be issued sometime around september 2020._ --- diff --git a/docs/index.md b/docs/index.md index e4fa0e5807..9ab5760bec 100644 --- a/docs/index.md +++ b/docs/index.md @@ -29,7 +29,7 @@ HTTPX is a fully featured HTTP client for Python 3, which provides sync and asyn We believe we've got the public API to a stable point now, but would strongly recommend pinning your dependencies to the `0.14.*` release, so that you're able to properly review [API changes between package updates](https://github.com/encode/httpx/blob/master/CHANGELOG.md). - A 1.0 release is expected to be issued sometime around mid-2020. + A 1.0 release is expected to be issued sometime around september 2020. ---