From 06cd3a97d17f3f0d0172f9d00a8bc9cecdd1ec9f Mon Sep 17 00:00:00 2001 From: Danny Hermes Date: Thu, 11 Aug 2016 10:43:37 -0700 Subject: [PATCH] Remove usage of os.environ.setdefault This is somewhat misleading, since it doesn't change the value of the env. var. in the shell. --- oauth2client/client.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/oauth2client/client.py b/oauth2client/client.py index 0b5ef5519..e89468b49 100644 --- a/oauth2client/client.py +++ b/oauth2client/client.py @@ -99,13 +99,12 @@ DEFAULT_ENV_NAME = 'UNKNOWN' # If set to True _get_environment avoid GCE check (_detect_gce_environment) -NO_GCE_CHECK = os.environ.setdefault('NO_GCE_CHECK', 'False') +NO_GCE_CHECK = os.getenv('NO_GCE_CHECK', 'False') # Timeout in seconds to wait for the GCE metadata server when detecting the # GCE environment. try: - GCE_METADATA_TIMEOUT = int( - os.environ.setdefault('GCE_METADATA_TIMEOUT', '3')) + GCE_METADATA_TIMEOUT = int(os.getenv('GCE_METADATA_TIMEOUT', 3)) except ValueError: # pragma: NO COVER GCE_METADATA_TIMEOUT = 3