GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(blob.py): auto-populate standard headers for non-chunked downloads by william-silversmith · Pull Request #204 · googleapis/python-storage

This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Conversation

@william-silversmith

@william-silversmith william-silversmith commented Jul 15, 2020 •
edited by tseaver
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #24 🦕

This PR autopopulates the following fields for non-chunked downloads based on the server header response:

blob.content_encoding
blob.content_type
blob.cache_control
blob.storage_class
blob.content_language
blob.md5_hash
blob.crc32c

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
william-silversmith added 9 commits July 14, 2020 16:15
@william-silversmith
fix: for non-chunked downloads, automatically populate standard fields
ccc169f
Content-Encoding
Content-Type
Content-Lanugage
Cache-Control
X-Goog-Storage-Class (self.storage_class)
@william-silversmith
fix: don't assume GRMP has a stable interface
46e2028
@william-silversmith
refactor: move commented out code to a more sensible location
4d37401
@william-silversmith
feat: extract crc32c and md5 from X-Goog-Hash
d6c9d28
@william-silversmith
fix: crashing when method is not defined
dc7a207
@william-silversmith
refactor(blob.py): change style to comport with black
cd2763d
@william-silversmith
refactor: remove unnecessary additional code path
42b62c8
@william-silversmith
docs: added docstring to new method
55601ce
@william-silversmith
fix: ensure x_goog_hash is set if an error is encountered
175f4d8
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 15, 2020
@william-silversmith william-silversmith changed the title Automatically Populate Standard Headers for Non-Chunked Downloads fix(blob.py): auto-populate standard headers for non-chunked downloads Jul 15, 2020
tseaver
tseaver suggested changes Jul 21, 2020
View reviewed changes

@tseaver tseaver left a comment

Copy link
Copy Markdown
Contributor

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.

@william-silversmith Thanks very much for the patch! In addition to tweaking the merge conflict, we need to add unit tests and / or assertions to show that the various properties are set / cleared based on the response payload.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

william-silversmith reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@tseaver tseaver changed the title fix(blob.py): auto-populate standard headers for non-chunked downloads feat(blob.py): auto-populate standard headers for non-chunked downloads Jul 21, 2020
william-silversmith added 3 commits July 21, 2020 17:54
@william-silversmith
Merge branch 'master' into master
c8f9226
@william-silversmith
refactor: no need to use 'raw' with a requests.Response
0deef45
@william-silversmith
test: extract headers from response
7b54722
@william-silversmith

william-silversmith commented Jul 22, 2020

Copy link
Copy Markdown
Contributor Author

@tseaver would these unit tests be sufficient? I can get more involved if necessary. I had trouble invoking _do_download, it was interacting strangely with "MagicMock" and dying on closing a file stream.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@william-silversmith william-silversmith mentioned this pull request Jul 22, 2020
Skip compression/decompression cycle in transfer_to seung-lab/cloud-files#10
Closed
@tseaver tseaver added kokoro:force-run Add this label to force Kokoro to re-run the tests. kokoro:run Add this label to force Kokoro to re-run the tests. labels Jul 23, 2020
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Jul 23, 2020
tseaver
tseaver approved these changes Jul 23, 2020
View reviewed changes
@tseaver tseaver added the automerge Merge the pull request once unit tests and other checks pass. label Jul 23, 2020
@tseaver

tseaver commented Jul 23, 2020

Copy link
Copy Markdown
Contributor

@william-silversmith Thanks, that new test was sufficient.

william-silversmith reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@william-silversmith

william-silversmith commented Jul 23, 2020

Copy link
Copy Markdown
Contributor Author

I'm a little confused because 806-808 have to be evaluated for the crc32c and md5_hash tests to pass.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tseaver
tseaver suggested changes Jul 23, 2020
View reviewed changes
Comment thread google/cloud/storage/blob.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@google-cla

google-cla Bot commented Jul 23, 2020

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@google-cla google-cla Bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Jul 23, 2020
This was referenced Jul 23, 2020
Add 'response_callback' argument to 'consume' / 'consume_next_chunk' methods. googleapis/google-resumable-media-python#113
Closed
feat: add 'response_callback' to 'consume' / 'consume_next_chunk' googleapis/google-resumable-media-python#114
Closed
@tseaver

tseaver commented Jul 23, 2020

Copy link
Copy Markdown
Contributor

@googlebot I consent

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@google-cla

google-cla Bot commented Jul 23, 2020

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@william-silversmith

william-silversmith commented Jul 23, 2020

Copy link
Copy Markdown
Contributor Author

@googlebot I fixed it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@google-cla

google-cla Bot commented Jul 23, 2020

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver tseaver added kokoro:force-run Add this label to force Kokoro to re-run the tests. kokoro:run Add this label to force Kokoro to re-run the tests. labels Jul 23, 2020
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Jul 23, 2020
tseaver
tseaver approved these changes Jul 23, 2020
View reviewed changes
@william-silversmith

william-silversmith commented Jul 23, 2020

Copy link
Copy Markdown
Contributor Author

I could try force pushing a double quote update that removes you as an author if that would be okay with you?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tseaver

tseaver commented Jul 23, 2020

Copy link
Copy Markdown
Contributor

@william-silversmith Sure, WFM.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@william-silversmith
chore: reformat whitespace with black
6a733d6
@google-cla google-cla Bot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jul 23, 2020
@tseaver tseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 23, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 23, 2020
@gcf-merge-on-green
gcf-merge-on-green Bot merged commit d8432cd into googleapis:master Jul 23, 2020
@tseaver

tseaver commented Jul 23, 2020

Copy link
Copy Markdown
Contributor

W00t! Thanks for persevering, @william-silversmith .

william-silversmith and nkemnitz reacted with hooray emoji
All reactions
  • 🎉 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@william-silversmith

william-silversmith commented Jul 23, 2020

Copy link
Copy Markdown
Contributor Author

Excited thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@HemangChothani HemangChothani mentioned this pull request Jul 27, 2020
coverage issue of blob file #215
Closed
@MartinKilonzo MartinKilonzo mentioned this pull request Sep 2, 2020
Hashes are no longer returned for partial downloads #266
Closed
@HemangChothani HemangChothani mentioned this pull request Oct 21, 2020
feat: add list prefix method #300
Closed
@andrewsg andrewsg mentioned this pull request Jul 22, 2021
blob.download_as_text followed by blob.upload_from_string raises a CRC32C validation error #487
Closed
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
@william-silversmith @cojenco
feat(blob.py): auto-populate standard headers for non-chunked downloa…
11655fe
…ds (googleapis#204)

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-storage/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)

Fixes googleapis#24  🦕

This PR autopopulates the following fields for non-chunked downloads based on the server header response:
```
blob.content_encoding
blob.content_type
blob.cache_control
blob.storage_class
blob.content_language
blob.md5_hash
blob.crc32c
```
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
@william-silversmith @cojenco
feat(blob.py): auto-populate standard headers for non-chunked downloa…
9f651f7
…ds (googleapis#204)

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-storage/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)

Fixes googleapis#24  🦕

This PR autopopulates the following fields for non-chunked downloads based on the server header response:
```
blob.content_encoding
blob.content_type
blob.cache_control
blob.storage_class
blob.content_language
blob.md5_hash
blob.crc32c
```
@release-please release-please Bot mentioned this pull request Jan 12, 2022
chore(main): release 3.0.0 #688
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@tseaver tseaver tseaver approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automerge Merge the pull request once unit tests and other checks pass. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Storage: Capture relevant headers to blob properties during download

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@william-silversmith @tseaver @googlebot @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.