OLD | NEW |
1 # Copyright 2013 The LUCI Authors. All rights reserved. | 1 # Copyright 2013 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 """Accesses files on Google Cloud Storage via Google Cloud Storage Client API. | 5 """Accesses files on Google Cloud Storage via Google Cloud Storage Client API. |
6 | 6 |
7 References: | 7 References: |
8 https://developers.google.com/appengine/docs/python/googlecloudstorageclient/ | 8 https://developers.google.com/appengine/docs/python/googlecloudstorageclient/ |
9 https://developers.google.com/storage/docs/accesscontrol#Signed-URLs | 9 https://developers.google.com/storage/docs/accesscontrol#Signed-URLs |
10 """ | 10 """ |
11 | 11 |
12 import base64 | 12 import base64 |
13 import collections | 13 import collections |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 def get_download_url(self, filename, expiration=DEFAULT_EXPIRATION): | 354 def get_download_url(self, filename, expiration=DEFAULT_EXPIRATION): |
355 """Returns signed URL that can be used to download a file.""" | 355 """Returns signed URL that can be used to download a file.""" |
356 return self.get_signed_url(filename, 'GET', expiration=expiration) | 356 return self.get_signed_url(filename, 'GET', expiration=expiration) |
357 | 357 |
358 def get_upload_url(self, filename, expiration=DEFAULT_EXPIRATION, | 358 def get_upload_url(self, filename, expiration=DEFAULT_EXPIRATION, |
359 content_type='', content_md5=''): | 359 content_type='', content_md5=''): |
360 """Returns signed URL that can be used to upload a file.""" | 360 """Returns signed URL that can be used to upload a file.""" |
361 return self.get_signed_url(filename, 'PUT', expiration=expiration, | 361 return self.get_signed_url(filename, 'PUT', expiration=expiration, |
362 content_type=content_type, content_md5=content_md5) | 362 content_type=content_type, content_md5=content_md5) |
OLD | NEW |