MCPcopy Create free account
hub / github.com/OpenOSINT/OpenOSINT / load_sessions

Function load_sessions

openosint/session_history.py:56–69  ·  view source on GitHub ↗

Return sessions sorted newest-first, optionally capped to `limit`.

(limit: int | None = None)

Source from the content-addressed store, hash-verified

54
55
56def load_sessions(limit: int | None = None) -> list[dict[str, Any]]:
57 """Return sessions sorted newest-first, optionally capped to `limit`."""
58 if not HISTORY_DIR.exists():
59 return []
60 files = sorted(HISTORY_DIR.glob("*_session.json"), reverse=True)
61 if limit is not None:
62 files = files[:limit]
63 sessions: list[dict[str, Any]] = []
64 for session_file in files:
65 try:
66 sessions.append(json.loads(session_file.read_text(encoding="utf-8")))
67 except Exception:
68 logger.debug("Failed to read session file: %s", session_file, exc_info=True)
69 return sessions
70
71
72def count_sessions() -> int:

Callers 6

runMethod · 0.90
_handle_historyFunction · 0.90

Calls

no outgoing calls