lumera 0.9.6__tar.gz → 0.9.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lumera-0.9.6 → lumera-0.9.7}/PKG-INFO +1 -1
- {lumera-0.9.6 → lumera-0.9.7}/lumera/_utils.py +38 -1
- {lumera-0.9.6 → lumera-0.9.7}/lumera.egg-info/PKG-INFO +1 -1
- {lumera-0.9.6 → lumera-0.9.7}/pyproject.toml +1 -1
- {lumera-0.9.6 → lumera-0.9.7}/lumera/__init__.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/automations.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/exceptions.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/files.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/google.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/integrations/__init__.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/integrations/google.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/llm.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/locks.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/pb.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/sdk.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/storage.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera/webhooks.py +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera.egg-info/SOURCES.txt +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera.egg-info/dependency_links.txt +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera.egg-info/requires.txt +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/lumera.egg-info/top_level.txt +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/setup.cfg +0 -0
- {lumera-0.9.6 → lumera-0.9.7}/tests/test_sdk.py +0 -0
|
@@ -19,6 +19,8 @@ from dotenv import load_dotenv
|
|
|
19
19
|
TOKEN_ENV = "LUMERA_TOKEN"
|
|
20
20
|
BASE_URL_ENV = "LUMERA_BASE_URL"
|
|
21
21
|
ENV_PATH = "/root/.env"
|
|
22
|
+
LOCAL_CREDS_PATH = ".lumera/credentials.json"
|
|
23
|
+
GLOBAL_CREDS_PATH = os.path.join(os.path.expanduser("~"), ".config", "lumera", "credentials.json")
|
|
22
24
|
|
|
23
25
|
load_dotenv(override=False)
|
|
24
26
|
load_dotenv(ENV_PATH, override=False)
|
|
@@ -56,12 +58,47 @@ def _get_session() -> requests.Session:
|
|
|
56
58
|
return _http_session
|
|
57
59
|
|
|
58
60
|
|
|
61
|
+
def _read_token_from_creds_file(path: str) -> str | None:
|
|
62
|
+
"""Read token from a credentials.json file."""
|
|
63
|
+
try:
|
|
64
|
+
if os.path.exists(path):
|
|
65
|
+
with open(path, "r") as f:
|
|
66
|
+
creds = json.load(f)
|
|
67
|
+
return creds.get("token")
|
|
68
|
+
except (json.JSONDecodeError, IOError):
|
|
69
|
+
pass
|
|
70
|
+
return None
|
|
71
|
+
|
|
72
|
+
|
|
59
73
|
def get_lumera_token() -> str:
|
|
74
|
+
"""Get Lumera API token from environment or credentials files.
|
|
75
|
+
|
|
76
|
+
Priority:
|
|
77
|
+
1. LUMERA_TOKEN environment variable
|
|
78
|
+
2. .lumera/credentials.json (project-local, from CLI login --local)
|
|
79
|
+
3. ~/.config/lumera/credentials.json (global, from CLI login)
|
|
80
|
+
4. /root/.env (legacy, for automations in sandbox)
|
|
81
|
+
"""
|
|
82
|
+
# 1. Check environment variable (highest priority)
|
|
60
83
|
token = os.getenv(TOKEN_ENV)
|
|
61
84
|
if token:
|
|
62
85
|
return token
|
|
86
|
+
|
|
87
|
+
# 2. Check project-local credentials
|
|
88
|
+
token = _read_token_from_creds_file(LOCAL_CREDS_PATH)
|
|
89
|
+
if token:
|
|
90
|
+
return token
|
|
91
|
+
|
|
92
|
+
# 3. Check global credentials
|
|
93
|
+
token = _read_token_from_creds_file(GLOBAL_CREDS_PATH)
|
|
94
|
+
if token:
|
|
95
|
+
return token
|
|
96
|
+
|
|
97
|
+
# 4. /root/.env is already loaded via dotenv at module load time
|
|
98
|
+
# so if we get here, no token was found anywhere
|
|
63
99
|
raise RuntimeError(
|
|
64
|
-
f"{TOKEN_ENV}
|
|
100
|
+
f"{TOKEN_ENV} not found. Checked: environment, {LOCAL_CREDS_PATH}, {GLOBAL_CREDS_PATH}, {ENV_PATH}. "
|
|
101
|
+
f"Run `lumera login` to authenticate."
|
|
65
102
|
)
|
|
66
103
|
|
|
67
104
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|