Skip to content

Commit 413bb81

Browse files
committed
Merge pull request googleapis#111 from aaronwinter/master
Avoid GCE checking if NO_GCE_CHECK is True
2 parents d0cb821 + 933e1d0 commit 413bb81

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

oauth2client/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@
9292
'AccessTokenInfo', ['access_token', 'expires_in'])
9393

9494
DEFAULT_ENV_NAME = 'UNKNOWN'
95+
96+
# If set to True _get_environment avoid GCE check (_detect_gce_environment)
97+
NO_GCE_CHECK = os.environ.setdefault('NO_GCE_CHECK', 'False')
98+
9599
class SETTINGS(object):
96100
"""Settings namespace for globally defined values."""
97101
env_name = None
@@ -970,7 +974,7 @@ def _get_environment(urlopen=None):
970974
SETTINGS.env_name = 'GAE_PRODUCTION'
971975
elif server_software.startswith('Development/'):
972976
SETTINGS.env_name = 'GAE_LOCAL'
973-
elif _detect_gce_environment(urlopen=urlopen):
977+
elif NO_GCE_CHECK != 'True' and _detect_gce_environment(urlopen=urlopen):
974978
SETTINGS.env_name = 'GCE_PRODUCTION'
975979

976980
return SETTINGS.env_name

0 commit comments

Comments
 (0)