aiohttp 3.0 release
Brief
Major release, many already deprecated things are removed
Minimal supported Python version is 3.5.3.
aiohttp uses shiny async
/await
syntax everywhere internally (while old yield from
is still supported).
Read https://docs.aiohttp.org/en/stable/whats_new_3_0.html for brief information about most important changes.
The full changelog is below:
3.0.0 (2018-02-12)
Features
- Speed up the
PayloadWriter.write
method for large request bodies. (#2126) - StreamResponse and Response are now MutableMappings. (#2246)
- ClientSession publishes a set of signals to track the HTTP request execution.
(#2313) - Content-Disposition fast access in ClientResponse (#2455)
- Added support to Flask-style decorators with class-based Views. (#2472)
- Signal handlers (registered callbacks) should be coroutines. (#2480)
- Support
async with test_client.ws_connect(...)
(#2525) - Introduce site and application runner as underlying API for
web.run_app
implementation. (#2530) - Only quote multipart boundary when necessary and sanitize input (#2544)
- Make the
aiohttp.ClientResponse.get_encoding
method public with the
processing of invalid charset while detecting content encoding. (#2549) - Add optional configurable per message compression for
ClientWebSocketResponse
andWebSocketResponse
. (#2551) - Add hysteresis to
StreamReader
to prevent flipping between paused and
resumed states too often. (#2555) - Support
.netrc
bytrust_env
(#2581) - Avoid to create a new resource when adding a route with the same name and
path of the last added resource (#2586) MultipartWriter.boundary
isstr
now. (#2589)- Allow a custom port to be used by
TestServer
(and associated pytest
fixtures) (#2613) - Add param access_log_class to web.run_app function (#2615)
- Add
ssl
parameter to client API (#2626) - Fixes performance issue introduced by #2577. When there are no middlewares
installed by the user, no additional and useless code is executed. (#2629) - Rename PayloadWriter to StreamWriter (#2654)
- New options reuse_port, reuse_address are added to
run_app
and
TCPSite
. (#2679) - Use custom classes to pass client signals parameters (#2686)
- Use
attrs
library for data classes, replacenamedtuple
. (#2690) - Pytest fixtures renaming, add
aiohttp_
prefix (#2578) - Add
aiohttp-
prefix forpytest-aiohttp
command line
parameters (#2578)
Bugfixes
- Correctly process upgrade request from server to HTTP2.
aiohttp
does not
support HTTP2 yet, the protocol is not upgraded but response is handled
correctly. (#2277) - Fix ClientConnectorSSLError and ClientProxyConnectionError for proxy
connector (#2408) - Fix connector convert OSError to ClientConnectorError (#2423)
- Fix connection attempts for multiple dns hosts (#2424)
- Fix writing to closed transport by raising
asyncio.CancelledError
(#2499) - Fix warning in
ClientSession.__del__
by stopping to try to close it.
(#2523) - Fixed race-condition for iterating addresses from the DNSCache. (#2620)
- Fix default value of
access_log_format
argument inweb.run_app
(#2649) - Freeze sub-application on adding to parent app (#2656)
- Do percent encoding for
.url_for()
parameters (#2668) - Correctly process request start time and multiple request/response
headers in access log extra (#2641)
Improved Documentation
- Improve tutorial docs, using
literalinclude
to link to the actual files.
(#2396) - Small improvement docs: better example for file uploads. (#2401)
- Rename
from_env
totrust_env
in client reference. (#2451) - Fixed mistype in
Proxy Support
section wheretrust_env
parameter was
used insession.get("http://python.org", trust_env=True)
method instead of
aiohttp.ClientSession constructor as follows:
aiohttp.ClientSession(trust_env=True)
. (#2688) - Fix issue with unittest example not compiling in testing docs. (#2717)
Deprecations and Removals
- Simplify HTTP pipelining implementation (#2109)
- Drop
StreamReaderPayload
andDataQueuePayload
. (#2257) - Drop
md5
andsha1
finger-prints (#2267) - Drop WSMessage.tp (#2321)
- Drop Python 3.4 and Python 3.5.0, 3.5.1, 3.5.2. Minimal supported Python
versions are 3.5.3 and 3.6.0.yield from
is gone, useasync/await
syntax.
(#2343) - Drop
aiohttp.Timeout
and useasync_timeout.timeout
instead. (#2348) - Drop
resolve
param from TCPConnector. (#2377) - Add DeprecationWarning for returning HTTPException (#2415)
send_str()
,send_bytes()
,send_json()
,ping()
andpong()
are
genuine async functions now. (#2475)- Drop undocumented
app.on_pre_signal
andapp.on_post_signal
. Signal
handlers should be coroutines, support for regular functions is dropped.
(#2480) StreamResponse.drain()
is not a part of public API anymore, just useawait StreamResponse.write()
.StreamResponse.write
is converted to async
function. (#2483)- Drop deprecated
slow_request_timeout
param and**kwargs`` from
RequestHandler`. (#2500) - Drop deprecated
resource.url()
. (#2501) - Remove
%u
and%l
format specifiers from access log format. (#2506) - Drop deprecated
request.GET
property. (#2547) - Simplify stream classes: drop
ChunksQueue
andFlowControlChunksQueue
,
mergeFlowControlStreamReader
functionality intoStreamReader
, drop
FlowControlStreamReader
name. (#2555) - Do not create a new resource on
router.add_get(..., allow_head=True)
(#2585) - Drop access to TCP tuning options from PayloadWriter and Response classes
(#2604) - Drop deprecated
encoding
parameter from client API (#2606) - Deprecate
verify_ssl
,ssl_context
andfingerprint
parameters in
client API (#2626) - Get rid of the legacy class StreamWriter. (#2651)
- Forbid non-strings in
resource.url_for()
parameters. (#2668) - Deprecate inheritance from
ClientSession
andweb.Application
and
custom user attributes forClientSession
,web.Request
and
web.Application
(#2691) - Drop
resp = await aiohttp.request(...)
syntax for sake ofasync with aiohttp.request(...) as resp:
. (#2540) - Forbid synchronous context managers for
ClientSession
and test
server/client. (#2362)
Misc
P.S.
Actual tag for aiohttp 3.0 is v3.0.1 because v3.0.0 had a couple minor bugs.
aiohttp 3.0.1 is proven as the first stable aiohttp 3.0 version.