Skip to content

Commit 7cd9d52

Browse files
Apply suggestions from code review
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 4fb6519 commit 7cd9d52

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test_all_tools.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,15 @@ def load_env():
2525
with open(env_path, 'r') as f:
2626
for line in f:
2727
line = line.strip()
28-
if line and not line.startswith('#') and '=' in line:
29-
key, value = line.split('=', 1)
30-
os.environ[key] = value
31-
else:
28+
if not line or line.startswith('#'):
29+
continue
30+
if line.startswith('export '):
31+
line = line[7:].strip()
32+
if '=' not in line:
33+
continue
34+
key, value = line.split('=', 1)
35+
value = value.strip().strip('"').strip("'")
36+
os.environ[key] = value
3237
print("⚠️ .env file not found. Please copy .env.example to .env and add your API key.")
3338
print(" Get your API key from: https://etherscan.io/apis")
3439
return False

0 commit comments

Comments
 (0)