This is an automated email from the ASF dual-hosted git repository.

anton pushed a commit to branch release-2.14.0
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/release-2.14.0 by this push:
     new 98de63d  Merge pull request #8925 from apache/aaltay-patch-1
     new 5911b65  Merge pull request #8926 from aaltay/release-2.14.0
98de63d is described below

commit 98de63d77d358c53fb025982a6ed773d1d99bcb3
Author: Ahmet Altay <aal...@gmail.com>
AuthorDate: Fri Jun 21 11:46:26 2019 -0700

    Merge pull request #8925 from apache/aaltay-patch-1
    
    [BEAM-7616] Add a timeout to urlopen calls
---
 sdks/python/apache_beam/internal/gcp/auth.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdks/python/apache_beam/internal/gcp/auth.py 
b/sdks/python/apache_beam/internal/gcp/auth.py
index 1c6d8e2..8b331e8 100644
--- a/sdks/python/apache_beam/internal/gcp/auth.py
+++ b/sdks/python/apache_beam/internal/gcp/auth.py
@@ -93,7 +93,7 @@ class _GCEMetadataCredentials(OAuth2Credentials):
     token_url = ('http://{}/computeMetadata/v1/instance/service-accounts/'
                  'default/token').format(metadata_root)
     req = Request(token_url, headers={'Metadata-Flavor': 'Google'})
-    token_data = json.loads(urlopen(req).read().decode('utf-8'))
+    token_data = json.loads(urlopen(req, timeout=60).read().decode('utf-8'))
     self.access_token = token_data['access_token']
     self.token_expiry = (refresh_time +
                          datetime.timedelta(seconds=token_data['expires_in']))

Reply via email to