-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Moto integration #1004
Moto integration #1004
Changes from 5 commits
50f7d4d
8c62277
37c598f
9f20dc2
37e12f5
5e2fc16
b47ee26
e9c670c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ pytest = "==6.2.4" | |
pytest-cov = "==2.11.1" | ||
pytest-asyncio = "==0.14.0" | ||
pytest-xdist = "==2.2.1" | ||
s3fs = "==2023.3.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this introduces a circular dependency, can't do it as it may later be incompatible with the version of aiobotocore this becomes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. Removed the dependency, used |
||
|
||
# this is needed for test_patches | ||
dill = "==0.3.3" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import asyncio | ||
from inspect import isawaitable | ||
|
||
from botocore.endpoint import ( | ||
DEFAULT_TIMEOUT, | ||
|
@@ -13,6 +14,7 @@ | |
logger, | ||
) | ||
from botocore.hooks import first_non_none_response | ||
from botocore.utils import lowercase_dict | ||
from urllib3.response import HTTPHeaderDict | ||
|
||
from aiobotocore.httpchecksum import handle_checksum_body | ||
|
@@ -37,30 +39,27 @@ async def convert_to_response_dict(http_response, operation_model): | |
|
||
""" | ||
response_dict = { | ||
# botocore converts keys to str, so make sure that they are in | ||
# the expected case. See detailed discussion here: | ||
# https://github.com/aio-libs/aiobotocore/pull/116 | ||
# aiohttp's CIMultiDict camel cases the headers :( | ||
'headers': HTTPHeaderDict( | ||
{ | ||
k.decode('utf-8').lower(): v.decode('utf-8') | ||
for k, v in http_response.raw.raw_headers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's important we use raw_headers as the non-raw doesn't preserve casing of the value There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, the alternative is kind of an ugly patch. Let me know what ya think |
||
} | ||
), | ||
'headers': HTTPHeaderDict(lowercase_dict(http_response.headers)), | ||
'status_code': http_response.status_code, | ||
'context': { | ||
'operation_name': operation_model.name, | ||
}, | ||
} | ||
if response_dict['status_code'] >= 300: | ||
response_dict['body'] = await http_response.content | ||
if isawaitable(http_response.content): | ||
response_dict['body'] = await http_response.content | ||
else: | ||
response_dict['body'] = http_response.content | ||
elif operation_model.has_event_stream_output: | ||
response_dict['body'] = http_response.raw | ||
elif operation_model.has_streaming_output: | ||
length = response_dict['headers'].get('content-length') | ||
response_dict['body'] = StreamingBody(http_response.raw, length) | ||
else: | ||
response_dict['body'] = await http_response.content | ||
if isawaitable(http_response.content): | ||
response_dict['body'] = await http_response.content | ||
else: | ||
response_dict['body'] = http_response.content | ||
return response_dict | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is more of add support for moto in-place mock methods