This is an automated email from the ASF dual-hosted git repository.
altay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 3dfff97 [BEAM-2101] Allow anonymous access of GCS blobs. (#4254)
3dfff97 is described below
commit 3dfff97fb4576df45985811a8869976ac4047fd3
Author: Udi Meiri <[email protected]>
AuthorDate: Sat Dec 16 19:13:30 2017 -0800
[BEAM-2101] Allow anonymous access of GCS blobs. (#4254)
This allows running the wordcount demo using the default input of
gs://apache-beam-samples/shakespeare/hamlet.txt without setting up GCP
credentials.
---
sdks/python/apache_beam/internal/gcp/auth.py | 8 +++++---
sdks/python/apache_beam/io/gcp/gcsio.py | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/sdks/python/apache_beam/internal/gcp/auth.py
b/sdks/python/apache_beam/internal/gcp/auth.py
index 35676f1..8478e1b 100644
--- a/sdks/python/apache_beam/internal/gcp/auth.py
+++ b/sdks/python/apache_beam/internal/gcp/auth.py
@@ -123,6 +123,8 @@ def get_service_credentials():
logging.debug('Connecting using Google Application Default '
'Credentials.')
return credentials
- except Exception:
- logging.warning('Unable to find default credentials to use.')
- raise
+ except Exception as e:
+ logging.warning(
+ 'Unable to find default credentials to use: %s\n'
+ 'Connecting anonymously.', e)
+ return None
diff --git a/sdks/python/apache_beam/io/gcp/gcsio.py
b/sdks/python/apache_beam/io/gcp/gcsio.py
index 448a0c9..68ca026 100644
--- a/sdks/python/apache_beam/io/gcp/gcsio.py
+++ b/sdks/python/apache_beam/io/gcp/gcsio.py
@@ -117,6 +117,7 @@ class GcsIO(object):
credentials = auth.get_service_credentials()
storage_client = storage.StorageV1(
credentials=credentials,
+ get_credentials=False,
http=httplib2.Http(timeout=DEFAULT_HTTP_TIMEOUT_SECONDS))
local_state.gcsio_instance = (
super(GcsIO, cls).__new__(cls, storage_client))
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].