This is an automated email from the ASF dual-hosted git repository. altay pushed a commit to branch aaltay-patch-1 in repository https://gitbox.apache.org/repos/asf/beam.git
commit f1a6e06eac1789a2b859edeaece6d4fdf080e5db Author: Ahmet Altay <[email protected]> AuthorDate: Fri Jun 21 09:59:18 2019 -0700 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']))
