Serve a GCS object.
(self, bucket, object_path, content_disposition=None)
| 63 | """Handler for signing and redirecting to a GCS object.""" |
| 64 | |
| 65 | def serve_gcs_object(self, bucket, object_path, content_disposition=None): |
| 66 | """Serve a GCS object.""" |
| 67 | url = get_signed_url(bucket, object_path) |
| 68 | |
| 69 | if content_disposition: |
| 70 | content_disposition_params = { |
| 71 | 'response-content-disposition': content_disposition, |
| 72 | } |
| 73 | |
| 74 | url += '&' + urllib.parse.urlencode(content_disposition_params) |
| 75 | |
| 76 | return self.redirect(url) # pylint: disable=no-member |
| 77 | |
| 78 | |
| 79 | def _get_expiration_time(expiry_seconds): |