Skip to main content

Returns

Returns a Session object.

Example

session = galtea.sessions.get_or_create(
    custom_id=custom_session_id,
    version_id=version_id,
    test_case_id=test_case_id,
)

Parameters

custom_id
string
required
The Custom ID of the session to fetch or create.
This is useful to associate sessions in the Galtea platform with those in your application.
version_id
string
required
The ID of the version to associate with this session if it needs to be created.
test_case_id
string
The test case ID. Forbidden when is_production=True. A non-production session may be created without a test case (e.g. externally ingested traces) — the context will then come from the request rather than the test case.
context
str
Additional context for the session. Forbidden when test_case_id is set (the context is derived from the test case).
is_production
boolean
A flag to indicate if the session represents real production traffic. When omitted on a newly created session, the API derives it from test_case_id presence: no test case means production.