Skip to main content

Python bindings for NotebookLM Enterprise API client

Project description

nblm - Python SDK for NotebookLM Enterprise API

Python bindings for the NotebookLM Enterprise API, powered by Rust via PyO3.

Warning: This project is not affiliated with, sponsored, or endorsed by Google. nblm-rs is an independent, unofficial tool. It is provided "as is" without any warranty.

Installation

pip install nblm

Or with uv:

uv add nblm

Requirements: Python 3.14 or later

Quick Start

from nblm import NblmClient, GCloudTokenProvider

# Initialize client
client = NblmClient(
    token_provider=GCloudTokenProvider(),
    project_number="123456789012"
)

# Create a notebook
notebook = client.create_notebook("My Notebook")
print(f"Created: {notebook.title}")

# Add sources
from nblm import WebSource

client.add_sources(
    notebook_id=notebook.notebook_id,
    web_sources=[WebSource(url="https://example.com", name="Example")]
)

# Create audio overview
audio = client.create_audio_overview(notebook.notebook_id)
print(f"Audio status: {audio.status}")

Features

  • Notebooks: Create, list, and delete notebooks
  • Sources: Add web, text, video sources; upload files; manage sources
  • Audio Overviews: Create podcast-style discussions from notebook content
  • Type Safety: Full type hints for IDE autocomplete and static analysis
  • Fast: Powered by Rust for high performance

Authentication

gcloud CLI (Recommended)

from nblm import NblmClient, GCloudTokenProvider

client = NblmClient(
    token_provider=GCloudTokenProvider(),
    project_number="123456789012"
)

Environment Variable

import os
from nblm import NblmClient, EnvTokenProvider

os.environ["NBLM_ACCESS_TOKEN"] = "your-access-token"

client = NblmClient(
    token_provider=EnvTokenProvider(),
    project_number="123456789012"
)

OAuth2 (Read-only)

Experimental: OAuth2 support currently requires setting NBLM_PROFILE_EXPERIMENT=1. Users must create an OAuth 2.0 Desktop application client ID in Google Cloud Console, including the client secret, before running this flow.

First, run the CLI once to complete the browser flow and store a refresh token:

export NBLM_OAUTH_CLIENT_ID="123-abc.apps.googleusercontent.com"
export NBLM_OAUTH_CLIENT_SECRET="your-desktop-client-secret"
export NBLM_PROFILE_EXPERIMENT=1
nblm --auth user-oauth --project-number 123456 notebooks list

Then reuse that token from Python without re-authenticating:

from nblm import NblmClient

client = NblmClient.with_user_oauth(
    project_number=123456,
    location="us-central1",
)

You can also instantiate the provider directly:

from nblm import UserOAuthProvider

provider = UserOAuthProvider.from_file(project_number=123456)

Documentation

Complete Python SDK documentation:

Examples

Create Notebook and Add Sources

from nblm import NblmClient, GCloudTokenProvider, WebSource, TextSource

client = NblmClient(
    token_provider=GCloudTokenProvider(),
    project_number="123456789012"
)

# Create notebook
notebook = client.create_notebook("Research: Python Best Practices")

# Add sources
client.add_sources(
    notebook_id=notebook.notebook_id,
    web_sources=[
        WebSource(url="https://peps.python.org/pep-0008/", name="PEP 8"),
        WebSource(url="https://docs.python-guide.org/")
    ],
    text_sources=[
        TextSource(content="Focus on code quality", name="Notes")
    ]
)

Upload Files

# Upload a PDF
response = client.upload_source_file(
    notebook_id=notebook.notebook_id,
    path="/path/to/document.pdf",
    display_name="Research Paper"
)
print(f"Uploaded: {response.source_id}")

Error Handling

from nblm import NblmError

try:
    notebook = client.create_notebook("My Notebook")
except NblmError as e:
    print(f"Error: {e}")

Type Hints

The library includes full type hints:

from nblm import (
    NblmClient,
    Notebook,
    NotebookSource,
    AudioOverviewResponse,
    WebSource,
    TextSource,
    VideoSource,
)

# All operations are fully typed
client: NblmClient
notebook: Notebook = client.create_notebook("Title")
audio: AudioOverviewResponse = client.create_audio_overview("abc123")

Supported Operations

Category Operations Status
Notebooks Create, list, delete Available
Sources Add (web, text, video), upload files, get, delete Available
Audio Overview Create, delete Available
Sharing Share with users Not available

Links

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nblm-0.2.3.tar.gz (84.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nblm-0.2.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.8 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

nblm-0.2.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.8 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

nblm-0.2.3-pp39-pypy39_pp73-macosx_10_12_x86_64.whl (2.6 MB view details)

Uploaded PyPymacOS 10.12+ x86-64

nblm-0.2.3-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

nblm-0.2.3-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.8 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

nblm-0.2.3-cp312-abi3-macosx_11_0_arm64.whl (2.5 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file nblm-0.2.3.tar.gz.

File metadata

  • Download URL: nblm-0.2.3.tar.gz
  • Upload date:
  • Size: 84.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nblm-0.2.3.tar.gz
Algorithm Hash digest
SHA256 1d6c2273f4076fa05b8e67e39e5567b64846581e5069ac6a50d86abd36386677
MD5 e2a08c3b3e8f50771e70c2462512ffba
BLAKE2b-256 a14c543a6f5c52d8fdfe7a6120f9b220c8847718880828548b94b7680074abc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for nblm-0.2.3.tar.gz:

Publisher: python-publish.yml on K-dash/nblm-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nblm-0.2.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nblm-0.2.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0bf943e2e922caf95228fe6fe3d0d1aebd4195596743ecd97fe37ed2d58f2836
MD5 f9d0172537a0f140f1b10a1156ba127c
BLAKE2b-256 dd5d5d8ad2b187d62d3c98e7c9fae2b842c26ec34e7b0185538ea90879df8790

See more details on using hashes here.

Provenance

The following attestation bundles were made for nblm-0.2.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python-publish.yml on K-dash/nblm-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nblm-0.2.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nblm-0.2.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 35954bd906ec10b9d96c23e7d2d6a8b176d27bfdff2562e5370db0ebd65844e0
MD5 c039a0c95bd19ec5afdb49e7e8ad8880
BLAKE2b-256 6cae2b88a46010c129d7b360395ee41dbc66239bf24ea98b1a11d56dda4e65f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for nblm-0.2.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python-publish.yml on K-dash/nblm-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nblm-0.2.3-pp39-pypy39_pp73-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nblm-0.2.3-pp39-pypy39_pp73-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c4c35dc8753fff2f7bf5e430f50f0fe23f37ffee7648686b8e15248545414d95
MD5 5ecc1529ad3c5279fb77764d8b106d5f
BLAKE2b-256 ce9a7ea3b6561edff06f9237f34597a98125b1a170872ad35e2802b302d26bfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for nblm-0.2.3-pp39-pypy39_pp73-macosx_10_12_x86_64.whl:

Publisher: python-publish.yml on K-dash/nblm-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nblm-0.2.3-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nblm-0.2.3-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07e0bcf07f57eb4e5f917eb5cc8ad68e812de05dc02d085a1de276ac881244fb
MD5 3956584068f21e088f589f271f7ac846
BLAKE2b-256 09c13361c12505c4c6ffd9a07117ef253e8dc650845065d30d7e4552c32b3217

See more details on using hashes here.

Provenance

The following attestation bundles were made for nblm-0.2.3-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on K-dash/nblm-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nblm-0.2.3-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for nblm-0.2.3-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5a38d53424bb1a48a70f318cb8e78fb222dcead4ed79d9cecc390013bb5835d0
MD5 72fb411e5e63e6a9c253b29f92088840
BLAKE2b-256 66b4704d6dd0c8b6712ae74eec3c843ef978bb5301e9ca699aa3f04f9c8c5922

See more details on using hashes here.

Provenance

The following attestation bundles were made for nblm-0.2.3-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python-publish.yml on K-dash/nblm-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nblm-0.2.3-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: nblm-0.2.3-cp312-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.12+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nblm-0.2.3-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e0de3865a33e3a4ce679f654ee248a26b49b2aa730dfaf12de44e695bd15ae7
MD5 3e1dbe57495c0764e58b9664885c16a2
BLAKE2b-256 ee3e3304c49f6a1512081afcfefc38502c423bcf0749ab561be0d01a620a4110

See more details on using hashes here.

Provenance

The following attestation bundles were made for nblm-0.2.3-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: python-publish.yml on K-dash/nblm-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page