From e4633ba133abb36a396bdabd4aff36d154d635c0 Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Thu, 8 Aug 2024 23:44:18 -0400 Subject: [PATCH] Simplify getting project ID logic --- geemap/common.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/geemap/common.py b/geemap/common.py index 619cc9becc..d0c0a0b4e2 100644 --- a/geemap/common.py +++ b/geemap/common.py @@ -72,13 +72,13 @@ def ee_initialize( if "http_transport" not in kwargs: kwargs["http_transport"] = httplib2.Http() + if project is None: + kwargs["project"] = get_api_key("EE_PROJECT_ID") + else: + kwargs["project"] = project + if auth_mode is None: if in_colab_shell() and (ee.data._credentials is None): - - if project is None: - kwargs["project"] = get_api_key("EE_PROJECT_ID") - # Authentication will automatically detect the Colab environment, - # no additional params needed. ee.Authenticate() ee.Initialize(**kwargs) return @@ -88,8 +88,6 @@ def ee_initialize( auth_args["auth_mode"] = auth_mode if ee.data._credentials is None: - if project is None: - kwargs["project"] = get_api_key("EE_PROJECT_ID") ee_token = get_api_key(token_name) if service_account: try: