Sessions
https://x.com/LumiTeh / https://www.lumiteh.com/ / https://github.com/LumiTeh-hub
Overview
Sessions are the core of our ecosystem. They preserve browser states and serve as a reliable foundation for performing web-based operations. Every action in the LumiTeh ecosystem—whether by an agent, a scrape, or a vault—is executed within a session.
Session Management
This demonstrates how to manage your browser sessions using the LumiTeh Python SDK.
from lumiteh_sdk import LumiTehClient
lumiteh = LumiTehClient()
# The session is automatically stopped when the context manager is exited
with lumiteh.Session(timeout_minutes=2) as session:
status = session.status()
print(status)
We strongly recommend using the API using a with
statement to manage the session lifecycle and ensure it is stopped when the context manager is exited.
Key points
Timeouts: Use the
timeout_minutes
parameter to define when a session should automatically stop due to inactivity. By default, sessions are terminated after 3 minutes without any actions.Session IDs: Each session is uniquely identified, e.g.
5767be7v-a11f5-47f4-bcb0-44qcaf875a66a3
and is tied to an API Key.
Operations
Operations provide granular control on the browser session:
observe()
To get the current state of a page and its available actionsexecute()
To execute an action you’ve previously observed on a pagescrape()
To extract structured data from a page
from lumiteh_sdk import LumiTehClient
lumiteh = LumiTehClient()
with lumiteh.Session() as page:
url = "https://www.linkedin.com/"
# observe page and take a step
page.execute({"type": "goto", "url": url})
obs = page.observe(instructions="click 'jobs'")
res = page.execute(obs.space.first())
print(res.message)
# another one
obs = page.observe(instructions="dismiss the sign in check")
res = page.execute(obs.space.first())
print(res.message)
Last updated