NotexAI
  • Quickstart
  • Python SDK
  • Authentication
  • Examples
    • Navigation
    • Scraping Flow
  • Browser Sessions
    • Session Management
    • Start Session
    • Close Session
    • Health
  • Browser Navigation
    • Observe Page
    • Step In Page
    • Scrape Data
Powered by GitBook
On this page
  • Session Management
  • Billing Management
  • Timeout Management
  • Important Notes
  1. Browser Sessions

Session Management

Learn how NotexAI manages sessions, billing, and timeouts.


Session Management

NotexAI uses sessions to maintain browser states and manage interactions. Each session is uniquely identified and must be explicitly started and closed using the SDK or REST API.

Key Points

  • Session Lifecycle:

    • Start a session using client.start().

    • Close a session using client.close().

  • Reusing Sessions:

    • By default, sessions are set to keep_alive=False, allowing them to be reused within their timeout period.

  • Session Limits:

    • Only one session can be active per client instance when using the SDK.

Example

from notexai.sdk.client import NotexClient

client = NotexClient(api_key="your-api-key")
# Start a session
session = client.start(keep_alive=True)
print("Session ID:", session.session_id)

# Close the session
response = client.close()
print("Session closed:", response.session_id)

Billing Management

Billing is based on API usage and session activity. Each API call contributes to usage metrics, which are billed according to your selected plan.

Key Points

  • Billing Units:

    • Actions like observe, scrape, and step consume API credits.

    • Credits are deducted based on the complexity of the operation.

  • Plan Details:

    • Billing rates and limits are available on the Billing Dashboard.

  • Usage Tracking:

    • Monitor usage and remaining credits in real-time on the Usage Dashboard.

Example

  • Observe usage metrics on the NotexAI dashboard.

  • Ensure you have sufficient API credits for operations.


Timeout Management

Timeouts ensure sessions are terminated after a predefined period of inactivity to optimize resource usage and cost.

Key Points

  • Default Timeout:

    • The default session timeout is 5 minutes.

    • Configurable during session start using the session_timeout parameter.

  • Timeout Behavior:

    • Sessions are automatically terminated after the timeout period unless keep_alive=True.

Example

# Start a session with a custom timeout
session = client.start(session_timeout=20)

# Start a session with persistent session
session = client.start(keep_alive=True) # default timeout is 5 minutes
# do something...

Important Notes

  • Ensure sessions are explicitly closed to avoid unnecessary billing.

  • Monitor timeout settings to prevent premature session termination.

PreviousScraping FlowNextStart Session

Last updated 4 months ago