| @@ -175,20 +175,6 @@ async def _fetch_tracks_for_tracker( | |||||
| tracker_id: str, | tracker_id: str, | ||||
| params: Optional[dict] = None, | params: Optional[dict] = None, | ||||
| ) -> List[dict]: | ) -> List[dict]: | ||||
| query_params = dict(params or {}) | |||||
| query_params["id"] = tracker_id | |||||
| try: | |||||
| payload = await _core_get_json(client, "/reslevis/getTracks", params=query_params) | |||||
| if not isinstance(payload, list): | |||||
| raise HTTPException(status_code=502, detail="Unexpected CORE response type") | |||||
| direct_rows = [_normalize_track(row) for row in payload if isinstance(row, dict)] | |||||
| if direct_rows: | |||||
| return direct_rows | |||||
| except HTTPException as exc: | |||||
| if exc.status_code != 404: | |||||
| raise | |||||
| payload = await _core_get_json(client, f"/reslevis/getTracks/{tracker_id}", params=params) | payload = await _core_get_json(client, f"/reslevis/getTracks/{tracker_id}", params=params) | ||||
| if not isinstance(payload, list): | if not isinstance(payload, list): | ||||
| raise HTTPException(status_code=502, detail="Unexpected CORE response type") | raise HTTPException(status_code=502, detail="Unexpected CORE response type") | ||||
| @@ -201,17 +187,6 @@ def _sort_tracks_desc(rows: List[dict]) -> List[dict]: | |||||
| async def _fetch_all_tracks(params: dict) -> List[dict]: | async def _fetch_all_tracks(params: dict) -> List[dict]: | ||||
| async with httpx.AsyncClient(timeout=30.0, verify=False) as client: | async with httpx.AsyncClient(timeout=30.0, verify=False) as client: | ||||
| try: | |||||
| payload = await _core_get_json(client, "/reslevis/getTracks", params=params) | |||||
| if not isinstance(payload, list): | |||||
| raise HTTPException(status_code=502, detail="Unexpected CORE response type") | |||||
| direct_rows = [_normalize_track(row) for row in payload if isinstance(row, dict)] | |||||
| if direct_rows: | |||||
| return direct_rows | |||||
| except HTTPException as exc: | |||||
| if exc.status_code != 404: | |||||
| raise | |||||
| trackers_payload = await _core_get_json(client, "/reslevis/getTrackers") | trackers_payload = await _core_get_json(client, "/reslevis/getTrackers") | ||||
| if not isinstance(trackers_payload, list): | if not isinstance(trackers_payload, list): | ||||
| raise HTTPException(status_code=502, detail="Unexpected CORE tracker response type") | raise HTTPException(status_code=502, detail="Unexpected CORE tracker response type") | ||||