A Python client for the Granola API
Project description
Granola Python Client
A Python client for the Granola API, inspired by the typescript client. This client allows programmatic interaction with Granola's note-taking and meeting management platform. It uses Pydantic for robust data validation and httpx for asynchronous HTTP requests. It can also mimic the official Granola desktop application headers to help bypass "Unsupported client" validation.
Features
- Async operations using
httpxandasyncio. - Runtime data validation and serialization using Pydantic models.
- Automatic token retrieval from local Granola app (macOS only).
- Mimics official client headers.
- Retry mechanism for requests.
- Pagination support for listing resources like documents.
Requirements
- Python 3.13+
uv(for package management, recommended)
Installation
It's recommended to use uv for managing dependencies in a virtual environment.
-
Install
uv: Follow the official instructions: https://github.com/astral-sh/uv#installation# Example for macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh
-
Clone the repository (if developing or installing from source):
git clone <repository_url> # Replace with your repo URL cd granola-python-client
-
Create and activate a virtual environment using
uv:uv venv source .venv/bin/activate # macOS/Linux # .venv\Scripts\activate # Windows
-
Install the package and its dependencies using
uv: For regular use:uv pip install -e . # For editable install from local source
For development (including test dependencies):
uv pip install -e ".[dev]"
Or, if published to PyPI in the future:
# uv pip install granola-client
Quick Start
import asyncio
import platform
from granola_client import GranolaClient, ClientOpts, GranolaAuthError, DocumentsResponse
async def main():
client = None
try:
api_token = "your-api-token" # Replace or use macOS auto-retrieval
if platform.system() == "Darwin" and api_token == "your-api-token":
print("Attempting to initialize client with automatic token retrieval (macOS)...")
client = GranolaClient()
else:
if api_token == "your-api-token":
print("Placeholder token detected. Please set a real token or run on macOS for auto-retrieval.")
return
client = GranolaClient(token=api_token)
# Get documents
print("\nRetrieving documents...")
documents_response: DocumentsResponse = await client.get_documents()
if documents_response and documents_response.docs:
print(f"Found {len(documents_response.docs)} documents:")
for doc in documents_response.docs:
print(f" - ID: {doc.document_id}, Title: {doc.title}")
else:
print("No documents found or response was empty.")
except GranolaAuthError as e:
print(f"Authentication Error: {e}")
except Exception as e:
print(f"An error occurred: {e}")
finally:
if client:
await client.close()
if __name__ == "__main__":
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file granola_client-0.4.0.tar.gz.
File metadata
- Download URL: granola_client-0.4.0.tar.gz
- Upload date:
- Size: 40.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1f558ce34b9d89bd83bb5a7e4c16f0f800ece44bd0b80d96707fac6ea45f3d4
|
|
| MD5 |
31e7f6cf0633b30951450476e0b07050
|
|
| BLAKE2b-256 |
afa7900a500b918f6818c876e91eb384f5693fea0ac9ad59e876455a27246b90
|
Provenance
The following attestation bundles were made for granola_client-0.4.0.tar.gz:
Publisher:
publish.yml on anjor/granola-py-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
granola_client-0.4.0.tar.gz -
Subject digest:
b1f558ce34b9d89bd83bb5a7e4c16f0f800ece44bd0b80d96707fac6ea45f3d4 - Sigstore transparency entry: 1393452636
- Sigstore integration time:
-
Permalink:
anjor/granola-py-client@a34d02bf7a5c60122d4a519e1f9e0fab56e1c27e -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/anjor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a34d02bf7a5c60122d4a519e1f9e0fab56e1c27e -
Trigger Event:
release
-
Statement type:
File details
Details for the file granola_client-0.4.0-py3-none-any.whl.
File metadata
- Download URL: granola_client-0.4.0-py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26daf5ca43877f24f28c2ce12d300488b2e72b2a9dd48169648be293914ca6ce
|
|
| MD5 |
914a977893cf0016d524190568ffa102
|
|
| BLAKE2b-256 |
b29b6a78d20f4a1c11eef4422e66d9a13742ad52b074ce7e40e39076d890576d
|
Provenance
The following attestation bundles were made for granola_client-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on anjor/granola-py-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
granola_client-0.4.0-py3-none-any.whl -
Subject digest:
26daf5ca43877f24f28c2ce12d300488b2e72b2a9dd48169648be293914ca6ce - Sigstore transparency entry: 1393452643
- Sigstore integration time:
-
Permalink:
anjor/granola-py-client@a34d02bf7a5c60122d4a519e1f9e0fab56e1c27e -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/anjor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a34d02bf7a5c60122d4a519e1f9e0fab56e1c27e -
Trigger Event:
release
-
Statement type: