Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 63 commits into from
Aug 7, 2020

Conversation

anibadde
Copy link
Contributor

@anibadde anibadde commented Aug 7, 2020

No description provided.

anibadde added 30 commits July 27, 2020 20:53
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 7, 2020
@tritone tritone marked this pull request as ready for review August 7, 2020 20:42
Copy link

@tritone tritone left a 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
'''
Copy link

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?

Copy link
Contributor Author

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.
Copy link

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link

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?

Copy link
Contributor

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 :(

Copy link
Contributor Author

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.

@crwilcox crwilcox merged commit e963b33 into googleapis:async Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants