Skip to content
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

Allow to capture head object (metadata) in download file #104

Open
wimglenn opened this issue Mar 29, 2018 · 3 comments
Open

Allow to capture head object (metadata) in download file #104

wimglenn opened this issue Mar 29, 2018 · 3 comments

Comments

@wimglenn
Copy link

Want to download an object along with its associated metadata, and I imagine that's a common use-case. The download_file method already issues a head request in order to get content length and decide whether to use multipart or not. Could you provide some kind of public API to capture this head_object so we don't need to make an extra request (slow, wasteful, and adds more race conditions)? I'm not sure the best interface, maybe just use the return value of download_file (currently just returns None) or add container/callback as optional argument.

@stealthycoin
Copy link
Contributor

Seems like a reasonable idea to me.

@dimaryaz
Copy link

I have a very similar feature request. I avoid the head request by passing a subscriber and calling provide_transfer_size - but I still need to get the response metadata, which could come from either the head or the get request. In case of multipart get, it gets a little weird since there will be multiple responses with (hopefully) identical metadata - but I think it's fair to expect the caller to deal with that.

I'm thinking of adding an on_start (or on_response?) to BaseSubscriber, and calling it from here. I'll send out a PR once I get something working.

@dimaryaz
Copy link

Sent out a PR: #113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants