Releases: encode/httpx
Version 0.15.5
Version 0.15.4
0.15.3
Version 0.15.2
Version 0.15.1
0.15.1 (September 23nd, 2020)
Fixed
- ASGITransport now properly applies URL decoding to the
path
component, as-per the ASGI spec. (Pull #1307)
Version 0.15.0
0.15.0 (22nd September 2020)
Added
- Added support for curio. (Pull encode/httpcore#168)
- Added support for event hooks. (Pull #1246)
- Added support for authentication flows which require either sync or async I/O. (Pull #1217)
- Added support for monitoring download progress with
response.num_bytes_downloaded
. (Pull #1268) - Added
Request(content=...)
for byte content, instead of overloadingRequest(data=...)
(Pull #1266) - Added support for all URL components as parameter names when using
url.copy_with(...)
. (Pull #1285) - Neater split between automatically populated headers on
Request
instances, vs defaultclient.headers
. (Pull #1248) - Unclosed
AsyncClient
instances will now raise warnings if garbage collected. (Pull #1197) - Support
Response(content=..., text=..., html=..., json=...)
for creating usable response instances in code. (Pull #1265, #1297) - Support instantiating requests from the low-level transport API. (Pull #1293)
- Raise errors on invalid URL types. (Pull #1259)
Changed
- Cleaned up expected behaviour for URL escaping.
url.path
is now URL escaped. (Pull #1285) - Cleaned up expected behaviour for bytes vs str in URL components.
url.userinfo
andurl.query
are not URL escaped, and so return bytes. (Pull #1285) - Drop
url.authority
property in favour ofurl.netloc
, since "authority" was semantically incorrect. (Pull #1285) - Drop
url.full_path
property in favour ofurl.raw_path
, for better consistency with other parts of the API. (Pull #1285) - No longer use the
chardet
library for auto-detecting charsets, instead defaulting to a simpler approach when no charset is specified. (#1269)
Fixed
- Swapped ordering of redirects and authentication flow. (Pull #1267)
.netrc
lookups should use host, not host+port. (Pull #1298)
Removed
- The
URLLib3Transport
class no longer exists. We've published it instead as an example of a custom transport class. (Pull #1182) - Drop
request.timer
attribute, which was being used internally to setresponse.elapsed
. (Pull #1249) - Drop
response.decoder
attribute, which was being used internally. (Pull #1276) Request.prepare()
is now a private method. (Pull #1284)
Version 0.14.3
Version 0.14.2
0.14.2 (August 24th, 2020)
Added
- Support
client.get(..., auth=None)
to bypass the default authentication on a clients. (Pull #1115) - Support
client.auth = ...
property setter. (Pull #1185) - Support
httpx.get(..., proxies=...)
on top-level request functions. (Pull #1198) - Display instances with nicer import styles. (Eg. <httpx.ReadTimeout ...>) (Pull #1155)
- Support
cookies=[(key, value)]
list-of-two-tuples style usage. (Pull #1211)
Fixed
- Ensure that automatically included headers on a request may be modified. (Pull #1205)
- Allow explicit
Content-Length
header on streaming requests. (Pull #1170) - Handle URL quoted usernames and passwords properly. (Pull #1159)
- Use more consistent default for
HEAD
requests, settingallow_redirects=True
. (Pull #1183) - If a transport error occurs while streaming the response, raise an
httpx
exception, not the underlyinghttpcore
exception. (Pull #1190) - Include the underlying
httpcore
traceback, when transport exceptions occur. (Pull #1199)
Version 0.14.1
0.14.1 (August 11th, 2020)
Added
- The
httpx.URL(...)
class now raiseshttpx.InvalidURL
on invalid URLs, rather than exposing the underlyingrfc3986
exception. If a redirect response includes an invalid 'Location' header, then aRemoteProtocolError
exception is raised, which will be associated with the request that caused it. (Pull #1163)
Fixed
- Handling multiple
Set-Cookie
headers became broken in the 0.14.0 release, and is now resolved. (Pull #1156)
Version 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
tohttps
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 ofhttpx.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 ofread_timeout=5.0
. - Use
httpx.Limits()
instead ofhttpx.PoolLimits()
, andlimits=...
instead ofpool_limits=...
. - The
httpx.Limits(max_keepalive=...)
argument is now deprecated in favour of a more explicithttpx.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()
andQueryParams.getlist()
are deprecated in favour of more consistent.get_list()
variants. - The
URL.is_ssl
property is deprecated in favour ofURL.scheme == "https"
. - The
URL.join(relative_url=...)
method is nowURL.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.
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 byASGITransport
,WSGITransport
. - Drop
dispatch=...`` on client, which has been replaced by
transport=...`` - Drop
soft_limit
,hard_limit
, which have been replaced bymax_keepalive
andmax_connections
. - Drop
Response.stream
and, which have been replaced by ``.aiter_bytes
and.aiter_raw
. - Drop
proxies=<transport instance>
in favor ofproxies=httpx.Proxy(...)
.
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)
andclient.params = None
. (Pull #1060)
Changed
- Use
httpx.codes
consistently in favour ofhttpx.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 ofread_timeout=5.0
. (Pull #1111) - Use
httpx.Limits()
instead ofhttpx.PoolLimits()
, andlimits=...
instead ofpool_limits=...
. (Pull #1113) - The
httpx.Limits(max_keepalive=...)
argument is now deprecated in favour of a more explicithttpx.Limits(max_keepalive_connections=...)
. - Keys used with
Client(proxies={...})
should now be in the style of{"http://": ...}
, rather than{"http": ...}
. (Pull #1127) - The multidict methods
Headers.getlist
andQueryParams.getlist
are deprecated in favour of more consistent.get_list()
variants. (Pull #1089) URL.port
becomesOptional[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 nowURL.join(url=...)
. (Pull #1129) - The
URL.is_ssl
property is deprecated in favour ofURL.scheme == "https"
. (Pull #1128)
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) - Ignore permission errors when accessing
.netrc
files. (Pull #1104) - Allow bare hostnames in
HTTP_PROXY
etc... environment variables. (Pull #1120) - Settings
app=...
ortransport=...
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)