Explore the open-source repository https://github.com/nottelabs/notte and star us 🌟

Prerequisites

  • An API key is required for connecting to our REST API or equivalent SDKs
  • Get a free API key on our console at console.notte.cc/keys

Technical requirements:

  • Python >= 3.11

How to Install

pip install notte

Configuration

Provide your API key for authentication. This can be set as an environment variable:

os.environ["NOTTE_API_KEY"] = "your-api-key"

Alternatively, pass the API key directly to the NotteClient:

from notte.sdk.client import NotteClient
client = NotteClient(api_key="your-api-key")

Using the SDK

Start a Session

Start a new session:

from notte.sdk.client import NotteClient

client = NotteClient(api_key="your-api-key")
session = client.start(keep_alive=True)
print(session.session_id)

Close a Session

Close the current session:

response = client.close()
print("Session closed:", response.session_id)

Observe a Webpage

Observe the state of a webpage:

observation = client.observe(url="https://example.com")
print("Page Title:", observation.title)
print("Available Actions:", observation.space.actions)

# Example Output:
# Flight Search
# * I1: Enter departure location (departureLocation: str = "San Francisco")
# * I3: Select departure date (departureDate: date)
# * I6: Select trip type (tripType: str = "round-trip", allowed=["round-trip", "one-way", "multi-city"])
# * B3: Search flight options with current filters
# 
# Website Navigation
# * B5: Open Google apps menu
# * L28: Navigate to Google homepage
# 
# User Preferences
# * B26: Open menu to change language settings
...

Step Through Actions

Execute an action on the observed page:

action_id = "navigate"
observation = client.step(action_id=action_id, value="https://another-example.com")
print("New Page Title:", observation.title)

Scrape Data

Scrape data from a page:

observation = client.scrape(url="https://example.com")
print("Scraped Data:", observation.data)

# Example Output:
# Flight Search inputs
# - Where from?: Paris
# - Where to?: London
# - Departure: Tue, Jan 14
# 
# Flight Search Results
# 20 of 284 results returned.
# They are ranked based on price and convenience
# 
# | Airline       | Departure  | Arrival  | Duration   | Stops     | Price |
# |---------------|------------|----------|------------|-----------|-------|
# | easyJet       | 10:15 AM   | 10:35 AM | 1 hr 20 min| Nonstop   | $62   |
# | Air France    | 4:10 PM    | 4:35 PM  | 1 hr 25 min| Nonstop   | $120  |

Managed API Services

We offer managed cloud browser sessions with the following premium add-ons:

  • Authentication: Built-in authentication for secure workflows.
  • Caching: Fast responses with intelligent caching.
  • Action Permissions: Control over sensitive actions.

Request access to a set of API keys on notte.cc.