From 5a45b09a6e630361b7951f0dfdf69bcd165b2a43 Mon Sep 17 00:00:00 2001 From: fsouza <108725+fsouza@users.noreply.github.com> Date: Wed, 1 Nov 2023 08:41:20 -0400 Subject: [PATCH] Use `os.environ.setdefault` --- examples/python/python.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/python/python.py b/examples/python/python.py index 9509b226f8..2422c489b1 100644 --- a/examples/python/python.py +++ b/examples/python/python.py @@ -22,10 +22,8 @@ from google.cloud import storage # This endpoint assumes that you are using the default port 4443 from the container. -# If you are using a different port you need to update this endpoint -os.environ["STORAGE_EMULATOR_HOST"] = os.environ.get( - "STORAGE_EMULATOR_HOST", "http://localhost:4443" -) +# If you are using a different port, please set the environment variable STORAGE_EMULATOR_HOST. +os.environ.setdefault("STORAGE_EMULATOR_HOST", "http://localhost:4443") client = storage.Client(