Package: web3http
HTTPX- A next-generation HTTP client for Python.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 the0.17.*release, so that you're able to properly reviewAPI changes between package updates. A 1.0 release is expected to be issued sometime in 2021.Let's get started...>>>importhttpx>>>r=httpx.get('https://www.example.org/')>>>r<Response [200 OK]>>>>r.status_code200>>>r.headers['content-type']'text/html; charset=UTF-8'>>>r.text'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'Or, using the async API...UseIPythonor Python 3.8+ withpython -m asyncioto try this code interactively.>>>importhttpx>>>asyncwithhttpx.AsyncClient()asclient:...r=awaitclient.get('https://www.example.org/')...>>>r<Response [200 OK]>FeaturesHTTPX builds on the well-established usability ofrequests, and gives you:A broadlyrequests-compatible API.Standard synchronous interface, but withasync support if you need it.HTTP/1.1and HTTP/2 support.Ability to make requests directly toWSGI applicationsorASGI applications.Strict timeouts everywhere.Fully type annotated.100% test coverage.Plus all the standard features ofrequests...International Domains and URLsKeep-Alive & Connection PoolingSessions with Cookie PersistenceBrowser-style SSL VerificationBasic/Digest AuthenticationElegant Key/Value CookiesAutomatic DecompressionAutomatic Content DecodingUnicode Response BodiesMultipart File UploadsHTTP(S) Proxy SupportConnection TimeoutsStreaming Downloads.netrc SupportChunked RequestsInstallationInstall with pip:$pipinstallhttpxOr, to include the optional HTTP/2 support, use:$pipinstallhttpx[http2]HTTPX requires Python 3.6+.DocumentationProject documentation is available athttps://www.python-httpx.org/.For a run-through of all the basics, head over to theQuickStart.For more advanced topics, see theAdvanced Usagesection, theasync supportsection, or theHTTP/2section.TheDeveloper Interfaceprovides a comprehensive API reference.To find out about tools that integrate with HTTPX, seeThird Party Packages.ContributeIf you want to contribute with HTTPX check out theContributing Guideto learn how to start.DependenciesThe HTTPX project relies on these excellent libraries:httpcore- The underlying transport implementation forhttpx.h11- HTTP/1.1 support.h2- HTTP/2 support.(Optional)certifi- SSL certificates.rfc3986- URL parsing & normalization.idna- Internationalized domain name support.sniffio- Async library autodetection.brotlipy- Decoding for "brotli" compressed responses.(Optional)A huge amount of credit is due torequestsfor the API layout that
much of this work follows, as well as tourllib3for plenty of design
inspiration around the lower-level networking details.— ⭐️ —HTTPX isBSD licensedcode. Designed & built in Brighton, England.ChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelog.0.17.0AddedAddhttpx.MockTransport(), allowing to mock out a transport using pre-determined responses. (Pull #1401, Pull #1449)Addhttpx.HTTPTransport()andhttpx.AsyncHTTPTransport()default transports. (Pull #1399)Add mount API support, usinghttpx.Client(mounts=...). (Pull #1362)Addchunk_sizeparameter toiter_raw(),iter_bytes(),iter_text(). (Pull #1277)Addkeepalive_expiryparameter tohttpx.Limits()configuration. (Pull #1398)Add repr tohttpx.Cookiesto display available cookies. (Pull #1411)Add support forparams=<tuple>(previously onlyparams=<list>was supported). (Pull #1426)FixedAdd missingraw_pathto ASGI scope. (Pull #1357)Tweakcreate_ssl_contextdefaults to usetrust_env=True. (Pull #1447)Properly URL-escape WSGIPATH_INFO. (Pull #1391)Properly set default ports in WSGI transport. (Pull #1469)Properly encode slashes when usingbase_url. (Pull #1407)Properly map exceptions inrequest.aclose(). (Pull #1465)0.16.1 (October 8th, 2020)FixedSupport literal IPv6 addresses in URLs. (Pull #1349)Force lowercase headers in ASGI scope dictionaries. (Pull #1351)0.16.0 (October 6th, 2020)ChangedPreserve HTTP header casing. (Pull #1338, encode/httpcore#216, python-hyper/h11#104)Dropresponse.next()andresponse.anext()methods in favour ofresponse.next_requestattribute. (Pull #1339)Closed clients now raise a runtime error if attempting to send a request. (Pull #1346)AddedAdd Python 3.9 to officially supported versions.Type annotate__enter__/__exit__/__aenter__/__aexit__in a way that supports subclasses ofClientandAsyncClient. (Pull #1336)0.15.5 (October 1st, 2020)AddedAddresponse.next_request(Pull #1334)0.15.4 (September 25th, 2020)AddedSupport direct comparisons betweenHeadersand dicts or lists of two-tuples. Eg.assert response.headers == {"Content-Length": 24}(Pull #1326)FixedFix automatic.read()whenResponseinstances are created withcontent=<str>(Pull #1324)0.15.3 (September 24th, 2020)FixedFixed connection leak in async client due to improper closing of response streams. (Pull #1316)0.15.2 (September 23nd, 2020)FixedFixedresponse.elapsedproperty. (Pull #1313)Fixed client authentication interaction with.stream(). (Pull #1312)0.15.1 (September 23nd, 2020)FixedASGITransport now properly applies URL decoding to thepathcomponent, as-per the ASGI spec. (Pull #1307)0.15.0 (September 22nd, 2020)AddedAdded support for curio. (Pullhttps://github.com/encode/httpcore/pull/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 withresponse.num_bytes_downloaded. (Pull #1268)AddedRequest(content=...)for byte content, instead of overloadingRequest(data=...)(Pull #1266)Added support for all URL components as parameter names when usingurl.copy_with(...). (Pull #1285)Neater split between automatically populated headers onRequestinstances, vs defaultclient.headers. (Pull #1248)UnclosedAsyncClientinstances will now raise warnings if garbage collected. (Pull #1197)SupportResponse(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)ChangedCleaned up expected behaviour for URL escaping.url.pathis now URL escaped. (Pull #1285)Cleaned up expected behaviour for bytes vs str in URL components.url.userinfoandurl.queryare not URL escaped, and so return bytes. (Pull #1285)Dropurl.authorityproperty in favour ofurl.netloc, since "authority" was semantically incorrect. (Pull #1285)Dropurl.full_pathproperty in favour ofurl.raw_path, for better consistency with other parts of the API. (Pull #1285)No longer use thechardetlibrary for auto-detecting charsets, instead defaulting to a simpler approach when no charset is specified. (#1269)FixedSwapped ordering of redirects and authentication flow. (Pull #1267).netrclookups should use host, not host+port. (Pull #1298)RemovedTheURLLib3Transportclass no longer exists. We've published it instead as an example ofa custom transport class. (Pull #1182)Droprequest.timerattribute, which was being used internally to setresponse.elapsed. (Pull #1249)Dropresponse.decoderattribute, which was being used internally. (Pull #1276)Request.prepare()is now a private method. (Pull #1284)TheHeaders.getlist()method had previously been deprecated in favour ofHeaders.get_list(). It is now fully removed.TheQueryParams.getlist()method had previously been deprecated in favour ofQueryParams.get_list(). It is now fully removed.TheURL.is_sslproperty had previously been deprecated in favour ofURL.scheme == "https". It is now fully removed.Thehttpx.PoolLimitsclass had previously been deprecated in favour ofhttpx.Limits. It is now fully removed.Themax_keepalivesetting had previously been deprecated in favour of the more explicitmax_keepalive_connections. It is now fully removed.The verbosehttpx.Timeout(5.0, connect_timeout=60.0)style had previously been deprecated in favour ofhttpx.Timeout(5.0, connect=60.0). It is now fully removed.Support for instantiating a timeout config missing some defaults, such ashttpx.Timeout(connect=60.0), had previously been deprecated in favour of enforcing a more explicit style, such ashttpx.Timeout(5.0, connect=60.0). This is now strictly enforced.0.14.3 (September 2nd, 2020)Addedhttp.Response()may now be instantiated without arequest=...parameter. Useful for some unit testing cases. (Pull #1238)Add103 Early Hintsand425 Too Earlystatus codes. (Pull #1244)FixedDigestAuthnow handles responses that include multiple 'WWW-Authenticate' headers. (Pull #1240)Call into transport__enter__/__exit__or__aenter__/__aexit__when client is used in a context manager style. (Pull #1218)0.14.2 (August 24th, 2020)AddedSupportclient.get(..., auth=None)to bypass the default authentication on a clients. (Pull #1115)Supportclient.auth = ...property setter. (Pull #1185)Supporthttpx.get(..., proxies=...)on top-level request functions. (Pull #1198)Display instances with nicer import styles. (Eg. <httpx.ReadTimeout ...>) (Pull #1155)Supportcookies=[(key, value)]list-of-two-tuples style usage. (Pull #1211)FixedEnsure that automatically included headers on a request may be modified. (Pull #1205)Allow explicitContent-Lengthheader on streaming requests. (Pull #1170)Handle URL quoted usernames and passwords properly. (Pull #1159)Use more consistent default forHEADrequests, settingallow_redirects=True. (Pull #1183)If a transport error occurs while streaming the response, raise anhttpxexception, not the underlyinghttpcoreexception. (Pull #1190)Include the underlyinghttpcoretraceback, when transport exceptions occur. (Pull #1199)0.14.1 (August 11th, 2020)AddedThehttpx.URL(...)class now raiseshttpx.InvalidURLon invalid URLs, rather than exposing the underlyingrfc3986exception. If a redirect response includes an invalid 'Location' header, then aRemoteProtocolErrorexception is raised, which will be associated with the request that caused it. (Pull #1163)FixedHandling multipleSet-Cookieheaders became broken in the 0.14.0 release, and is now resolved. (Pull #1156)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 usepip install httpx[http2]if you want to include the HTTP/2 dependancies.Our HSTS support has now been removed. Rewriting URLs fromhttptohttpsif 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 existinghttpx.HTTPErrorusage, but we've got a clearer overall structure now. Seehttps://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 usehttpx.codesconsistently instead ofhttpx.StatusCodes.Usage ofhttpx.Timeout()should now always include an explicit default. Eg.httpx.Timeout(None, pool=5.0).When usinghttpx.Timeout(), we now have more concisely named keyword arguments. Eg.read=5.0, instead ofread_timeout=5.0.Usehttpx.Limits()instead ofhttpx.PoolLimits(), andlimits=...instead ofpool_limits=....Thehttpx.Limits(max_keepalive=...)argument is now deprecated in favour of a more explicithttpx.Limits(max_keepalive_connections=...).Keys used withClient(proxies={...})should now be in the style of{"http://": ...}, rather than{"http": ...}.The multidict methodsHeaders.getlist()andQueryParams.getlist()are deprecated in favour of more consistent.get_list()variants.TheURL.is_sslproperty is deprecated in favour ofURL.scheme == "https".TheURL.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 forhttpx, 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 thehttpxdocumentation..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.DropASGIDispatch,WSGIDispatch, which have been replaced byASGITransport,WSGITransport.Dropdispatch=...`` on client, which has been replaced bytransport=...``Dropsoft_limit,hard_limit, which have been replaced bymax_keepaliveandmax_connections.DropResponse.streamandResponse.raw, which have been replaced by ``.aiter_bytesand.aiter_raw.Dropproxies=<transport instance>in favor ofproxies=httpx.Proxy(...).See pull requests #1057, #1058.AddedAdded dedicated exception classhttpx.HTTPStatusErrorfor.raise_for_status()exceptions. (Pull #1072)Addedhttpx.create_ssl_context()helper function. (Pull #996)Support for proxy exlcusions likeproxies={"https://www.example.com": None}. (Pull #1099)SupportQueryParams(None)andclient.params = None. (Pull #1060)ChangedUsehttpx.codesconsistently in favour ofhttpx.StatusCodeswhich is placed into deprecation. (Pull #1088)Usage ofhttpx.Timeout()should now always include an explicit default. Eg.httpx.Timeout(None, pool=5.0). (Pull #1085)Switch to more concisehttpx.Timeout()keyword arguments. Eg.read=5.0, instead ofread_timeout=5.0. (Pull #1111)Usehttpx.Limits()instead ofhttpx.PoolLimits(), andlimits=...instead ofpool_limits=.... (Pull #1113)Keys used withClient(proxies={...})should now be in the style of{"http://": ...}, rather than{"http": ...}. (Pull #1127)The multidict methodsHeaders.getlistandQueryParams.getlistare deprecated in favour of more consistent.get_list()variants. (Pull #1089)URL.portbecomesOptional[int]. Now only returns a port if one is explicitly included in the URL string. (Pull #1080)TheURL(..., allow_relative=[bool])parameter no longer exists. All URL instances may be relative. (Pull #1073)Drop unnecessaryurl.full_path = ...property setter. (Pull #1069)TheURL.join(relative_url=...)method is nowURL.join(url=...). (Pull #1129)TheURL.is_sslproperty is deprecated in favour ofURL.scheme == "https". (Pull #1128)FixedAdd missingResponse.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 forResponse.iter_lines(). (Pull #1033, #1075)Ignore permission errors when accessing.netrcfiles. (Pull #1104)Allow bare hostnames inHTTP_PROXYetc... environment variables. (Pull #1120)Settingsapp=...ortransport=...bypasses any environment based proxy defaults. (Pull #1122)Fix handling of.base_urlwhen a path component is included in the base URL. (Pull #1130)0.13.3 (May 29th, 2020)FixedInclude missing keepalive expiry configuration. (Pull #1005)Improved error message when URL redirect has a custom scheme. (Pull #1002)0.13.2 (May 27th, 2020)FixedInclude explicit "Content-Length: 0" on POST, PUT, PATCH if no request body is used. (Pull #995)Addhttp2option tohttpx.Client. (Pull #982)Tighten up API typing in places. (Pull #992, #999)0.13.1 (May 22nd, 2020)FixedFix pool options deprecation warning. (Pull #980)Includehttpx.URLLib3ProxyTransportin top-level API. (Pull #979)0.13.0 (May 22nd, 2020)This release switches tohttpcorefor all the internal networking, which means:We're using the same codebase for both our sync and async clients.HTTP/2 support is now available with the sync client.We no longer have aurllib3dependency for our sync client, although there is still anoptionalURLLib3Transportclass.It also means we've had to remove our UDS support, since maintaining that would have meant having to push back our work towards a 1.0 release, which isn't a trade-off we wanted to make.We also now havea public "Transport API", which you can use to implement custom transport implementations against. This formalises and replaces our previously private "Dispatch API".ChangedUsehttpcorefor underlying HTTP transport. Dropurllib3requirement. (Pull #804, #967)Rename pool limit options fromsoft_limit/hard_limittomax_keepalive/max_connections. (Pull #968)The previous private "Dispatch API" has now been promoted to a public "Transport API". When customizing the transport usetransport=.... TheASGIDispatchandWSGIDispatchclass naming is deprecated in favour ofASGITransportandWSGITransport. (Pull #963)AddedAddedURLLib3Transportclass for optionalurllib3transport support. (Pull #804, #963)Streaming multipart uploads. (Pull #857)Logging via HTTPCORE_LOG_LEVEL and HTTPX_LOG_LEVEL environment variables
and TRACE level logging. (Pull encode/httpcore#79)FixedPerformance improvement in brotli decoder. (Pull #906)Proper warning level of deprecation notice inResponse.streamandResponse.raw. (Pull #908)Fix support for generator based WSGI apps. (Pull #887)Reuse of connections on HTTP/2 in close concurrency situations. (Pull encode/httpcore#81)Honor HTTP/2 max concurrent streams settings (Pull encode/httpcore#89, encode/httpcore#90)Fix bytes support in multipart uploads. (Pull #974)Improve typing support forfiles=.... (Pull #976)RemovedDropped support forClient(uds=...)(Pull #804)0.13.0.dev2 (May 12th, 2020)The 0.13.0.dev2 is apre-releaseversion. To install it, usepip install httpx --pre.AddedLogging via HTTPCORE_LOG_LEVEL and HTTPX_LOG_LEVEL environment variables
and TRACE level logging. (HTTPCore Pull #79)FixedReuse of connections on HTTP/2 in close concurrency situations. (HTTPCore Pull #81)When using anapp=<ASGI app>observe neater disconnect behaviour instead of sending empty body messages. (Pull #919)0.13.0.dev1 (May 6th, 2020)The 0.13.0.dev1 is apre-releaseversion. To install it, usepip install httpx --pre.FixedPassinghttp2flag to proxy dispatchers. (Pull #934)Usehttpcorev0.8.3which addresses problems in handling of headers when using proxies.0.13.0.dev0 (April 30th, 2020)The 0.13.0.dev0 is apre-releaseversion. To install it, usepip install httpx --pre.This release switches tohttpcorefor all the internal networking, which means:We're using the same codebase for both our sync and async clients.HTTP/2 support is now available with the sync client.We no longer have aurllib3dependency for our sync client, although there is still anoptionalURLLib3Dispatcherclass.It also means we've had to remove our UDS support, since maintaining that would have meant having to push back our work towards a 1.0 release, which isn't a trade-off we wanted to make.ChangedUsehttpcorefor underlying HTTP transport. Dropurllib3requirement. (Pull #804)AddedAddedURLLib3Dispatcherclass for optionalurllib3transport support. (Pull #804)Streaming multipart uploads. (Pull #857)FixedPerformance improvement in brotli decoder. (Pull #906)Proper warning level of deprecation notice inResponse.streamandResponse.raw. (Pull #908)Fix support for generator based WSGI apps. (Pull #887)RemovedDropped support forClient(uds=...)(Pull #804)0.12.1 (March 19th, 2020)FixedResolved packaging issue, where additional files were being included.0.12.0 (March 9th, 2020)The 0.12 release tightens up the API expectations forhttpxby switching to private module names to enforce better clarity around public API.All imports ofhttpxshould import from the top-level package only, such asfrom httpx import Request, rather than importing from privately namespaced modules such asfrom httpx._models import Request.AddedSupport making response body available to auth classes with.requires_response_body. (Pull #803)ExportNetworkErrorexception. (Pull #814)Add support forNO_PROXYenvironment variable. (Pull #835)ChangedSwitched to private module names. (Pull #785)Drop redirect looping detection and theRedirectLoopexception, instead usingTooManyRedirects. (Pull #819)Dropbackend=...parameter onAsyncClient, in favour of always autodetectingtrio/asyncio. (Pull #791)FixedSupport basic auth credentials in proxy URLs. (Pull #780)Fixhttpx.Proxy(url, mode="FORWARD_ONLY")configuration. (Pull #788)Fallback to setting headers as UTF-8 if no encoding is specified. (Pull #820)Close proxy dispatches classes on client close. (Pull #826)Support customcertparameters even ifverify=False. (Pull #796)Don't support invalid dict-of-dicts form data indata=.... (Pull #811)0.11.1 (January 17th, 2020)FixedFixed usage ofproxies=...onClient(). (Pull #763)Support bothzlibanddeflatestyle encodings onContent-Encoding: deflate. (Pull #758)Fix for streaming a redirect response body withallow_redirects=False. (Pull #766)Handle redirect with malformed Location headers missing host. (Pull #774)0.11.0 (January 9th, 2020)The 0.11 release reintroduces our sync support, so thathttpxnow supports both a standard thread-concurrency API, and an async API.Existing asynchttpxusers that are upgrading to 0.11 should ensure that:Async codebases should always use a client instance to make requests, instead of the top-level API.The async client is named ashttpx.AsyncClient(), instead ofhttpx.Client().When instantiating proxy configurations use thehttpx.Proxy()class, instead of the previoushttpx.HTTPProxy(). This new configuration class works for configuring both sync and async clients.We believe the API is now pretty much stable, and are aiming for a 1.0 release sometime on or before April 2020.ChangedTop level API such ashttpx.get(url, ...),httpx.post(url, ...),httpx.request(method, url, ...)becomes synchronous.Addedhttpx.Client()for synchronous clients, withhttpx.AsyncClientbeing used for async clients.Switched toproxies=httpx.Proxy(...)for proxy configuration.Network connection errors are wrapped inhttpx.NetworkError, rather than exposing lower-level exception types directly.RemovedTherequest.url.originproperty andhttpx.Originclass are no longer available.The per-requestcert,verify, andtrust_envarguments are escalated from raising errors if used, to no longer being available. These arguments should be used on a per-client instance instead, or in the top-level API.Thestreamargument has escalated from raising an error when used, to no longer being available. Use theclient.stream(...)orhttpx.stream()streaming API instead.FixedRedirect loop detection matches against(method, url)rather thanurl. (Pull #734)0.10.1 (December 31st, 2019)FixedFix issue with concurrent connection acquiry. (Pull #700)Fix write error on closing HTTP/2 connections. (Pull #699)0.10.0 (December 29th, 2019)The 0.10.0 release makes some changes that will allow us to support both sync and async interfaces.In particular with streaming responses theresponse.read()method becomesresponse.aread(), and theresponse.close()method becomesresponse.aclose().If following redirects explicitly theresponse.next()method becomesresponse.anext().FixedEnd HTTP/2 streams immediately on no-body requests, rather than sending an empty body message. (Pull #682)Improve typing forResponse.request: switch fromOptional[Request]toRequest. (Pull #666)Response.elapsednow reflects the entire download time. (Pull #687, #692)ChangedAddedAsyncClientas a synonym forClient. (Pull #680)Switch toresponse.aread()for conditionally reading streaming responses. (Pull #674)Switch toresponse.aclose()andclient.aclose()for explicit closing. (Pull #674, #675)Switch toresponse.anext()for resolving the next redirect response. (Pull #676)RemovedWhen using a client instance, the per-request usage ofverify,cert, andtrust_envhave now escalated from raising a warning to raising an error. You should set these arguments on the client instead. (Pull #617)Removed the undocumentedrequest.read(), since end users should not require it.0.9.5 (December 20th, 2019)FixedFix Host header and HSTS rewrites when an explicit:80port is included in URL. (Pull #649)Query Params on the URL string are merged with anyparams=...argument. (Pull #653)More robust behavior when closing connections. (Pull #640)More robust behavior when handling HTTP/2 headers with trailing whitespace. (Pull #637)Allow any explicitContent-Typeheader to take precedence over the encoding default. (Pull #633)0.9.4 (December 12th, 2019)FixedAdded expiry to Keep-Alive connections, resolving issues with acquiring connections. (Pull #627)Increased flow control windows on HTTP/2, resolving download speed issues. (Pull #629)0.9.3 (December 7th, 2019)FixedFixed HTTP/2 with autodetection backend. (Pull #614)0.9.2 (December 7th, 2019)Released due to packaging build artifact.0.9.1 (December 6th, 2019)Released due to packaging build artifact.0.9.0 (December 6th, 2019)The 0.9 releases brings some major new features, including:A new streaming API.Autodetection of either asyncio or trio.Nicer timeout configuration.HTTP/2 support off by default, but can be enabled.We've also removed all private types from the top-level package export.In order to ensure you are only ever working with public API you should make
sure to only import the top-level package eg.import httpx, rather than
importing modules within the package.AddedAdded concurrency backend autodetection. (Pull #585)AddedClient(backend='trio')andClient(backend='asyncio')API. (Pull #585)Addedresponse.stream_lines()API. (Pull #575)Addedresponse.is_errorAPI. (Pull #574)Added support fortimeout=Timeout(5.0, connect_timeout=60.0)styles. (Pull #593)FixedRequests or Clients withtimeout=Nonenow correctly always disable timeouts. (Pull #592)Request 'Authorization' headers now have priority over.netrcauthentication info. (Commit 095b691)Files without a filename no longer set a Content-Type in multipart data. (Commit ed94950)ChangedAddedhttpx.stream()API. Usingstream=Truenow results in a warning. (Pull #600, #610)HTTP/2 support is switched to "off by default", but can be enabled explicitly. (Pull #584)Switched toClient(http2=True)API fromClient(http_versions=["HTTP/1.1", "HTTP/2"]). (Pull #586)Removed all private types from the top-level package export. (Pull #608)The SSL configuration settings ofverify,cert, andtrust_envnow raise warnings if used per-request when using a Client instance. They should always be set on the Client instance itself. (Pull #597)Use plain strings "TUNNEL_ONLY" or "FORWARD_ONLY" on the HTTPProxyproxy_modeargument. TheHTTPProxyModeenum still exists, but its usage will raise warnings. (#610)Pool timeouts are now on the timeout configuration, not the pool limits configuration. (Pull #563)The timeout configuration is now namedhttpx.Timeout(...), nothttpx.TimeoutConfig(...). The old version currently remains as a synonym for backwards compatability.  (Pull #591)0.8.0 (November 27, 2019)RemovedThe 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)AddedAdd support for proxy tunnels for Python 3.6 + asyncio. (Pull #521)0.7.7 (November 15, 2019)FixedResolve an issue with cookies behavior on redirect requests. (Pull #529)AddedAdd request/response DEBUG logs. (Pull #502)Use TRACE log level for low level info. (Pull #500)0.7.6 (November 2, 2019)RemovedDropproxiesparameter from the high-level API. (Pull #485)FixedTweak multipart files: omit null filenames, add support forstrfile contents. (Pull #482)Cache NETRC authentication per-client. (Pull #400)Rely ongetproxiesfor all proxy environment variables. (Pull #470)Wait for theasynciostream to close when closing a connection. (Pull #494)0.7.5 (October 10, 2019)AddedAllow lists of values to be passed toparams. (Pull #386)ASGIDispatch,WSGIDispatchare now available in thehttpx.dispatchnamespace. (Pull #407)HTTPErroris now available in thehttpxnamespace.  (Pull #421)Add support forstart_tls()to the Trio concurrency backend. (Pull #467)FixedUsername and password are no longer included in theHostheader when basic authentication
credentials are supplied via the URL. (Pull #417)RemovedThe.delete()function no longer hasjson,data, orfilesparameters
to match the expected semantics of theDELETEmethod. (Pull #408)Removed thetrioextra. Trio support is detected automatically. (Pull #390)0.7.4 (September 25, 2019)AddedAdd Trio concurrency backend. (Pull #276)Addparamsparameter toClientfor setting default query parameters. (Pull #372)Add support forSSL_CERT_FILEandSSL_CERT_DIRenvironment variables. (Pull #307)Add debug logging to calls into ASGI apps. (Pull #371)Add debug logging to SSL configuration. (Pull #378)FixedFix a bug when usingClientwithout timeouts in Python 3.6. (Pull #383)PropagateClientconfiguration to HTTP proxies. (Pull #377)0.7.3 (September 20, 2019)AddedHTTP Proxy support. (Pulls #259, #353)Add Digest authentication. (Pull #332)Add.build_request()method toClientandAsyncClient. (Pull #319)Add.elapsedproperty on responses. (Pull #351)Add support forSSLKEYLOGFILEin Python 3.8b4+. (Pull #301)RemovedDrop NPN support for HTTP version negotiation. (Pull #314)FixedFix distribution of type annotations for mypy (Pull #361).SetHostheader when redirecting cross-origin. (Pull #321)DropContent-Lengthheaders onGETredirects. (Pull #310)RaiseKeyErrorif header isn't found inHeaders. (Pull #324)RaiseNotRedirectResponseinresponse.next()if there is no redirection to perform. (Pull #297)Fix bug in calculating the HTTP/2 maximum frame size. (Pull #153)0.7.2 (August 28, 2019)Enforce usinghttpx.AsyncioBackendfor the synchronous client. (Pull #232)httpx.ConnectionPoolwill properly release a dropped connection. (Pull #230)Remove theraise_app_exceptionsargument fromClient. (Pull #238)DecodeErrorwill no longer be raised for an empty body encoded with Brotli. (Pull #237)Addedhttp_versionsparameter toClient. (Pull #250)Only use HTTP/1.1 on short-lived connections likehttpx.get(). (Pull #284)ConvertClient.cookiesandClient.headerswhen set as a property. (Pull #274)SettingHTTPX_DEBUG=1enables debug logging on all requests. (Pull #277)0.7.1 (August 18, 2019)Include files with source distribution to be installable. (Pull #233)0.7.0 (August 17, 2019)Add thetrust_envproperty toBaseClient. (Pull #187)Add thelinksproperty toBaseResponse. (Pull #211)Acceptssl.SSLContextinstances intoSSLConfig(verify=...). (Pull #215)AddResponse.stream_text()with incremental encoding detection. (Pull #183)Properly updated theHostheader when a redirect changes the origin. (Pull #199)Ignore invalidContent-Encodingheaders. (Pull #196)Use~/.netrcand~/_netrcfiles by default whentrust_env=True. (Pull #189)Create exception base classHTTPErrorwithrequestandresponseproperties. (Pull #162)Add HSTS preload list checking withinBaseClientto upgrade HTTP URLs to HTTPS. (Pull #184)Switch IDNA encoding from IDNA 2003 to IDNA 2008. (Pull #161)Expose base classes for alternate concurrency backends. (Pull #178)Improve Multipart parameter encoding. (Pull #167)Add theheadersproeprty toBaseClient. (Pull #159)Add support for Google'sbrotlilibrary. (Pull #156)Remove deprecated TLS versions (TLSv1 and TLSv1.1) from defaultSSLConfig. (Pull #155)FixURL.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
connection inConnectionPool.keepalive_connections(Pull #145)Allow string comparison forURLobjects (Pull #139)Add HTTP status codes 418 and 451 (Pull #135)Add support for client certificate passwords (Pull #118)Enable post-handshake client cert authentication for TLSv1.3 (Pull #118)Disable usingcommonNamefor hostname checking for OpenSSL 1.1.0+ (Pull #118)Detect encoding forResponse.json()(Pull #116)0.6.7 (July 8, 2019)Check for connection aliveness on re-acquiry (Pull #111)0.6.6 (July 3, 2019)ImproveUSER_AGENT(Pull #110)AddConnection: keep-aliveby default to HTTP/1.1 connections. (Pull #110)0.6.5 (June 27, 2019)IncludeHostheader by default. (Pull #109)Improve HTTP protocol detection. (Pull #107)0.6.4 (June 25, 2019)Implement read and write timeouts (Pull #104)0.6.3 (June 24, 2019)Handle early connection closes (Pull #103)0.6.2 (June 23, 2019)Use urllib3'sDEFAULT_CIPHERSfor theSSLConfigobject. (Pull #100)0.6.1 (June 21, 2019)Add support for setting abase_urlon theClient.0.6.0 (June 21, 2019)Honorlocal_flow_control_windowfor HTTP/2 connections (Pull #98)