Shared Session: work with Python and XOE together

Python and the Xplain Object Explorer (XOE) can share the same analytics session. Changes made via a Python script are reflected in XOE immediately, and vice versa. This page explains how to connect Python to a running XOE session using http_session_id.

Session ID concepts

There are two distinct identifiers involved in session sharing:

Parameter

What it is

How to get it

http_session_id

The browser’s JSESSIONID HTTP cookie. Identifies the authenticated HTTP connection between your browser and the Xplain server.

Browser developer tools → Application → Cookies → JSESSIONID

Xplain session ID

The 32-character analytics session identifier managed by the Xplain server. Controls which dataset and selections are loaded.

session.get_session_id() in Python, or XOE Settings → Session

Passing http_session_id lets Python reuse the browser’s existing authenticated connection — no username or password needed. Passing the Xplain session ID via load_from_session_id() loads a specific dataset state into an independently authenticated Python session.

Scenario 1: XOE is running — Python joins the session

Use this when XOE is already open in your browser and you want Python to work on the same session without creating a new login.

Step 1 — Get the JSESSIONID from your browser

Open browser developer tools (F12), go to Application → Storage → Cookies → <server URL> and copy the value of JSESSIONID.

JSESSIONID: A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6

Step 2 — Connect Python using http_session_id

from xplain import Xsession

session = Xsession(
    url="http://myhost:8080",
    http_session_id="A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6"
)

Python reuses the browser’s authenticated HTTP connection. No username or password is required because the existing JSESSIONID cookie is still valid.

Step 3 — Verify and continue working

# Confirm which analytics session is active
print(session.get_session_id())

# Continue analysis — changes appear in XOE immediately
session.show_tree()

Scenario 2: Python has started the session — XOE joins

Use this when Python created the session first and you want to visualise or interact with it in XOE.

Step 1 — Start the session in Python and retrieve its ID

from xplain import Xsession

session = Xsession(url="http://myhost:8080", user="myUser", password="myPassword")
session.startup("DemoStartUp")

print(session.get_session_id())
# A674FF134333C72CE2ICE1782B8006C

Scenario 3: get the Xplain session ID from XOE — Python joins by ID

Use this when XOE is already running and you want Python to load the same analytics session state using its own independent login (no browser cookie needed):

Step 1 — Enable Developer Mode in XOE and copy the Session ID

In XOE Settings, enable Developer Mode:

../../../../_images/python_xoe_Setting.png ../../../../_images/python_enable_developer_mode.png

After enabling, refresh XOE (Ctrl+R / Cmd+R / F5). Go to Settings → Session and copy the Session ID:

../../../../_images/python_session_id.png

Step 2 — Load the session in Python

from xplain import Xsession

session = Xsession(url="http://myhost:8080", user="myUser", password="myPassword")
session.load_from_session_id("A674FF134333C72CE2ICE1782B8006C")

Note

load_from_session_id() requires a full credential-based login first. Use http_session_id (Scenario 1) instead if you want to skip re-authentication by reusing the browser’s existing HTTP connection.