Skip to content

Commit

Permalink
Merge pull request #19 from cbrichford/streams-fix
Browse files Browse the repository at this point in the history
Fixing streaming responses.
  • Loading branch information
jettify committed Jan 31, 2016
2 parents 7bafb7c + 79d31f1 commit a010d4a
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion aiobotocore/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ def convert_to_response_dict(http_response, operation_model):
return response_dict


class ClientResponseContentProxy:
"""Proxy object for content stream of http response"""

def __init__(self, response):
self.__response = response
self.__content = self.__response.content

def __getattr__(self, item):
return getattr(self.__content, item)

def __dir__(self):
attrs = dir(self.__content)
attrs.append('close')
return attrs

def close(self):
self.__response.close()

class ClientResponseProxy:
"""Proxy object for http response useful for porting from
botocore underlying http library."""
Expand All @@ -46,7 +64,7 @@ def __getattr__(self, item):
if item == 'content':
return self._body
if item == 'raw':
return getattr(self._impl, 'content')
return ClientResponseContentProxy(self._impl)

return getattr(self._impl, item)

Expand Down

0 comments on commit a010d4a

Please sign in to comment.