lkr-dev-cli 0.0.21__py3-none-any.whl → 0.0.22__py3-none-any.whl

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.
lkr/observability/main.py CHANGED
@@ -6,7 +6,7 @@ from uuid import uuid4
6
6
 
7
7
  import typer
8
8
  import uvicorn
9
- from fastapi import Depends, FastAPI, HTTPException, Query
9
+ from fastapi import Depends, FastAPI, HTTPException, Query, Request
10
10
  from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
11
11
  from pydash import get
12
12
  from selenium import webdriver
@@ -17,6 +17,7 @@ from selenium.webdriver.remote.webdriver import WebDriver
17
17
  from selenium.webdriver.support import expected_conditions as EC
18
18
  from selenium.webdriver.support.ui import WebDriverWait
19
19
 
20
+ from lkr.logging import structured_logger
20
21
  from lkr.observability.classes import (
21
22
  EmbedSDKObj,
22
23
  IframeRequestEvent,
@@ -52,7 +53,17 @@ def get_embed_sdk_obj(
52
53
  user_attributes: str = Query(default="{}"),
53
54
  secret_id: str = Query(default=None),
54
55
  ):
55
- user_attributes_dict = json.loads(user_attributes)
56
+ try:
57
+ user_attributes_dict = json.loads(user_attributes)
58
+ except json.JSONDecodeError as e:
59
+ structured_logger.error(
60
+ "JSONDecodeError: Invalid user attributes",
61
+ error=str(e),
62
+ user_attributes=user_attributes,
63
+ )
64
+ return None
65
+ except Exception:
66
+ return None
56
67
  return EmbedSDKObj(
57
68
  dashboard_id=dashboard_id,
58
69
  external_user_id=external_user_id,
@@ -122,13 +133,19 @@ def settings():
122
133
 
123
134
  @app.get("/health")
124
135
  def health_check(
125
- params: EmbedSDKObj = Depends(get_embed_sdk_obj),
136
+ request: Request,
137
+ params: EmbedSDKObj | None = Depends(get_embed_sdk_obj),
126
138
  open: bool = Query(default=False),
127
139
  ):
128
140
  """
129
141
  Launch a headless browser, open the embed container, and wait for the completion indicator.
130
142
  Returns health status and timing info.
131
143
  """
144
+ if not params:
145
+ raise HTTPException(
146
+ status_code=400,
147
+ detail=f"Invalid parameters: {str(request.query_params)}",
148
+ )
132
149
  session_id = str(uuid4())
133
150
  redirect = False
134
151
  observability_ctx.external_user_id = params.external_user_id
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lkr-dev-cli
3
- Version: 0.0.21
3
+ Version: 0.0.22
4
4
  Summary: lkr: a command line interface for looker
5
5
  Author: bwebs
6
6
  License-Expression: MIT
@@ -6,7 +6,6 @@ lkr/exceptions.py,sha256=M_aR4YaCZtY4wyxhcoqJCVkxVu9z3Wwo5KgSDyOoEnI,210
6
6
  lkr/logging.py,sha256=bBGdxkVrUidRTJAvqGHyQ5KS6IJGYDCoool5tTB_JxM,1822
7
7
  lkr/main.py,sha256=5m036LAS4PTLIzpWW5ohxIs2FGYtVf-OwYnTmtrpnxU,1933
8
8
  lkr/types.py,sha256=feJ-W2U61PJTiotMLuZJqxrotA53er95kO1O30mooy4,323
9
- lkr/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
9
  lkr/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
10
  lkr/auth/main.py,sha256=ebGp-NdgULodHaDrLKspnGSFf_sOkV2Vanil1NbOJKY,7382
12
11
  lkr/auth/oauth.py,sha256=-QCb7YGIqmuTiy6SZcUTbVZrDo7itOpUUOK1VuvfMqM,5987
@@ -14,9 +13,9 @@ lkr/embed/observability/utils.py,sha256=Hv3g60cI03cQwyEe8QV7bUMssE6pyrZKnDyl9rxm
14
13
  lkr/mcp/main.py,sha256=39VO0_bdscrCW7BC3kdlgjfIWaNigpT38HZ74_Drm-A,22853
15
14
  lkr/observability/classes.py,sha256=5kQnHxa3pgUartrbccuG0yMClfoFqYCXY8iCTJTZvgk,6025
16
15
  lkr/observability/embed_container.html,sha256=BMzV_jfBhcussUExf0KccOmOTAO3UEV7SuZ4lznQ0no,2758
17
- lkr/observability/main.py,sha256=Oo9ro6jCm_qSG4Fv377pS2BWW-SIjtbhGLGGFMrlRCA,8036
18
- lkr_dev_cli-0.0.21.dist-info/METADATA,sha256=7lD040SjtJdLv8JGASaFxtBbu4NcA8maWEo2XZGv3TM,10663
19
- lkr_dev_cli-0.0.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
20
- lkr_dev_cli-0.0.21.dist-info/entry_points.txt,sha256=nn2sFMGDpwUVE61ZUpbDPnQZkW7Gc08nV-tyLGo8q34,37
21
- lkr_dev_cli-0.0.21.dist-info/licenses/LICENSE,sha256=hKnCOORW1JRE_M2vStz8dblS5u1iR-2VpqS9xagKNa0,1063
22
- lkr_dev_cli-0.0.21.dist-info/RECORD,,
16
+ lkr/observability/main.py,sha256=6xAcaW4ruxGZDiGHNTi0oIaQnI6HhKxsjCZ5jq_ldsE,8557
17
+ lkr_dev_cli-0.0.22.dist-info/METADATA,sha256=Yp81tfskRQC4vKRCecxXGmmBK7eiT5Djf_fBzj9VFyo,10663
18
+ lkr_dev_cli-0.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
19
+ lkr_dev_cli-0.0.22.dist-info/entry_points.txt,sha256=nn2sFMGDpwUVE61ZUpbDPnQZkW7Gc08nV-tyLGo8q34,37
20
+ lkr_dev_cli-0.0.22.dist-info/licenses/LICENSE,sha256=hKnCOORW1JRE_M2vStz8dblS5u1iR-2VpqS9xagKNa0,1063
21
+ lkr_dev_cli-0.0.22.dist-info/RECORD,,
lkr/utils.py DELETED
File without changes