Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for compressed responses #298

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Changes
-------
0.4.4a0 (XXXX-XX-XX)
^^^^^^^^^^^^^^^^^^
* bump aiohttp requirement to support compressed responses correctly #298

0.4.3 (2017-07-05)
^^^^^^^^^^^^^^^^^^
Expand Down
17 changes: 9 additions & 8 deletions aiobotocore/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,22 +252,23 @@ def __init__(self, host,
conn_timeout=self._conn_timeout,
skip_auto_headers={'CONTENT-TYPE'},
response_class=ClientResponseProxy,
loop=self._loop)
loop=self._loop,
auto_decompress=False)

@asyncio.coroutine
def _request(self, method, url, headers, data):
# Note: When using aiobotocore with dynamodb, requests fail on crc32
# checksum computation as soon as the response data reaches ~5KB.
# botocore itself does not support compressed responses yet:
# https://github.com/boto/botocore/issues/1255. However aiohttp sets
# the accept headers for a variety of compressed encodings...so for
# example when using aiobotocore with dynamodb calls, requests fail on
# crc32 checksum computation as soon as the response ata reaches ~5KB.
# When AWS response is gzip compressed:
# 1. aiohttp is automatically decompressing the data
# (http://aiohttp.readthedocs.io/en/stable/client.html#binary-response-content)
# 2. botocore computes crc32 on the uncompressed data bytes and fails
# cause crc32 has been computed on the compressed data
# The following line forces aws not to use gzip compression,
# if there is a way to configure aiohttp not to perform decompression,
# we can remove the following line and take advantage of
# aws gzip compression.
# See: https://github.com/aio-libs/aiohttp/issues/1992
# The following line forces aws not to use gzip compression. After
# botocore adds compressed response support we can remove this section.
headers['Accept-Encoding'] = 'identity'
headers_ = MultiDict(
(z[0], text_(z[1], encoding='utf-8')) for z in headers.items())
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# aiohttp requirement is pegged as we need to manually ensure that
# https://github.com/aio-libs/aiobotocore/pull/248 will continue working
install_requires = ['botocore>=1.5.71, <=1.5.78', 'aiohttp>=2.0.4, <=2.3.0',
install_requires = ['botocore>=1.5.71, <=1.5.78', 'aiohttp>=2.X.X, <=2.X.X',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updates her should fix CI

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, broken on purpose for now so we set the right version that's needed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

'multidict>=2.1.4', 'wrapt>=1.10.10', 'packaging>=16.8']

PY_VER = sys.version_info
Expand Down