From 62389e2f525974ca0fb5fb53e18ca4db70b4357b Mon Sep 17 00:00:00 2001 From: gelioz <> Date: Thu, 2 Jul 2020 16:51:04 +0100 Subject: [PATCH 1/2] Avoid unnecessary GCS storage.buckets.get permission --- .gitignore | 3 +++ smart_open/gcs.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 04e894c6..485c6929 100644 --- a/.gitignore +++ b/.gitignore @@ -60,5 +60,8 @@ target/ # PyCharm .idea/ +# VSCode +.vscode/ + # env files .env diff --git a/smart_open/gcs.py b/smart_open/gcs.py index 6b27e31e..7c882e40 100644 --- a/smart_open/gcs.py +++ b/smart_open/gcs.py @@ -211,7 +211,7 @@ def __init__( if client is None: client = google.cloud.storage.Client() - self._blob = client.get_bucket(bucket).get_blob(key) # type: google.cloud.storage.Blob + self._blob = client.bucket(bucket).get_blob(key) # type: google.cloud.storage.Blob if self._blob is None: raise google.cloud.exceptions.NotFound('blob %s not found in %s' % (key, bucket)) From a459c84966094349de302ac60921b6d335f49738 Mon Sep 17 00:00:00 2001 From: Michael Penkov Date: Fri, 3 Jul 2020 14:36:56 +0900 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65399928..47dd10fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased + - Bypass unnecessary GCS storage.buckets.get permission (PR [#516](https://github.com/RaRe-Technologies/smart_open/pull/516), [@gelioz](https://github.com/gelioz)) + # 2.1.0, 1 July 2020 - Azure storage blob support ([@nclsmitchell](https://github.com/nclsmitchell) and [@petedannemann](https://github.com/petedannemann))