I want to create Quick Share link, for an individual file on digital ocean spaces so that Anyone with the link will be able to view a private file during the specified time interval. I am using Django . An assistance will be appreciated.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
You can create a “Quick Share link” by generating a “pre-signed” URL using
boto3
or another Python client library for S3-compatible object storage services.With
boto3
, you first need to configure your session:Then you can generate a functioning pre-signed url using:
Note the
ExpiresIn
argument. By default, pre-signed URLs will expire in an hour (3600 seconds). This example sets it to expire in 5 minutes. See the boto3 docs for more info.