File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -134,3 +134,6 @@ __pycache__/
134134run_act_test.bat
135135.DS_Store
136136* .py~
137+
138+ # Streamlit secrets
139+ .streamlit /secrets.toml
Original file line number Diff line number Diff line change @@ -47,9 +47,11 @@ def _load_api_key() -> Optional[str]:
4747 # 2. Environment Variable
4848 api_key = os .environ .get ("APIKEY" )
4949 if api_key :
50+ print ("DEBUG: Found APIKEY in os.environ" )
5051 return api_key
5152
5253 cwd = os .getcwd ()
54+ print (f"DEBUG: CWD is { cwd } " )
5355
5456 # 3. api_key file
5557 api_key_path = os .path .join (cwd , "api_key" )
@@ -59,15 +61,21 @@ def _load_api_key() -> Optional[str]:
5961
6062 # 4. .env file
6163 env_path = os .path .join (cwd , ".env" )
64+ print (f"DEBUG: Checking .env at { env_path } " )
6265 if os .path .isfile (env_path ):
66+ print ("DEBUG: .env file exists" )
6367 with open (env_path , "r" ) as f :
6468 for line in f :
6569 stripped = line .strip ()
6670 if not stripped or stripped .startswith ("#" ) or "=" not in stripped :
6771 continue
6872 key , value = stripped .split ("=" , 1 )
73+ # print(f"DEBUG: Seen key: {key}")
6974 if key .strip () == "APIKEY" and value .strip ():
75+ print ("DEBUG: Found APIKEY in .env" )
7076 return value .strip ()
77+ else :
78+ print ("DEBUG: .env file NOT found" )
7179 return None
7280
7381
You can’t perform that action at this time.
0 commit comments