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

Add all extra parameters and expiration to geturl method #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

franagustin
Copy link

@franagustin franagustin commented Nov 17, 2022

Allow for users to provide extra parameters (i.e. ResponseContentDisposition, ResponseContentType) and custom expiration time for presigned urls generated by geturl.

@willmcgugan @zopyx @atollk @althonos

@franagustin
Copy link
Author

Bump @willmcgugan @zopyx @atollk @althonos

@atollk
Copy link
Member

atollk commented Feb 11, 2024

Hi. Sorry, I must've missed your first mention.

I'm not that familiar with S3. Could you provide some additional context on why this change is needed / what benefit it provides?

@franagustin
Copy link
Author

Hi. Sorry, I must've missed your first mention.

I'm not that familiar with S3. Could you provide some additional context on why this change is needed / what benefit it provides?

@atollk Heya! Sure.

When we generate a presigned URL from an S3 bucket, the token which gets appended to the URL has an expiration timestamp.
They last for an hour, by default, but we have an use case in which we need the files to be available for a whole day (so 24 hours).
Therefore why I've added this expiration parameter which defaults to 3600 seconds.

The extra keyword arguments can be used to take further advantage of S3 options. Check this example in which we set a content-disposition and a default filename for downloads (because the file in the bucket has a different name based on internal ID):

 kwargs = {
        "ResponseContentDisposition": f"attachment; filename = example.csv",
        "ResponseContentType": "csv",
}

@atollk
Copy link
Member

atollk commented Feb 17, 2024

Makes sense to me. Maybe a small comment for that function explaining the meaning of the arguments (or at least linking to something like https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3/client/generate_presigned_url.html) would be helpful for future users here?

Other than that, I'm okay with this being merged. But tbh I have no idea how the release process for this package is, so you might still have to refer to the git repository for your dependency to include your change.

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

Successfully merging this pull request may close these issues.

2 participants