-
Notifications
You must be signed in to change notification settings - Fork 322
Feat: gzip/decompressed response content handling #584
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
Conversation
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.
Mostly looks fine, some docs and cleanup comments.
In order to more closely resemble the `requests` interface, where a raw | ||
and deflated content could be accessed at once, this class lazily reads the | ||
stream in `transport.Response` so both return forms can be used | ||
''' |
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.
Use double quotes for docstring. Does this need to be fleshed out more?
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.
Resolved, changed to double quotes with blacken.
self._raw_content = None | ||
|
||
def _is_compressed(self): | ||
# The gzip and deflate transfer-encodings are automatically decoded for you. |
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 comment is a bit unclear, maybe rephrase.
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.
possibly move this into the comment up top as this is the point of this added class.
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.
Fleshed out this comment in the latest version to explain reasoning.
@@ -230,8 +280,16 @@ async def request( | |||
transmitted. The timout error will be raised after such | |||
request completes. | |||
""" | |||
# Headers come in as bytes which isn't expected behavior (resumable) |
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.
What do you mean by "isn't expected behavior"? Can you clarify to explain why the lines below are necessary?
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 isn't expected as most headers are of a str type. It is odd that some come through as bytes. This may be a bandaid, or may be entirely necessary :(
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.
Added more explanation to why we are doing this. Inconsistencies in the header value types for some cases in the resumable library, which is why we have this check.
Co-authored-by: Christopher Wilcox <[email protected]>
No description provided.