Metadata-Version: 2.4
Name: extrasuite
Version: 0.9.0
Summary: Client library for ExtraSuite - secure OAuth token exchange for CLI tools
Project-URL: Homepage, https://github.com/think41/extrasuite
Project-URL: Documentation, https://extrasuite.think41.com
Project-URL: Repository, https://github.com/think41/extrasuite
Project-URL: Issues, https://github.com/think41/extrasuite/issues
Author-email: Sripathi Krishnan <sripathi@think41.com>
License: MIT
License-File: LICENSE
Keywords: cli,docs,drive,google,oauth,sheets,workspace
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Session
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: extradoc>=0.4.2
Requires-Dist: extraform>=0.3.1
Requires-Dist: extrascript>=0.2.1
Requires-Dist: extrasheet>=0.3.1
Requires-Dist: extraslide>=0.2.3
Requires-Dist: keyring>=25.0
Requires-Dist: markdown>=3.0
Requires-Dist: tomli>=2.0; python_version < '3.11'
Provides-Extra: ssl
Requires-Dist: certifi>=2024.0.0; extra == 'ssl'
Description-Content-Type: text/markdown

# extrasuite

Python client library for ExtraSuite's v2 session-token authentication flow.

## Installation

```bash
pip install extrasuite
```

## Configuration

Use one of these:

1. `EXTRASUITE_SERVER_URL=https://your-server.example.com`
2. `~/.config/extrasuite/gateway.json` containing `{"EXTRASUITE_SERVER_URL": "https://your-server.example.com"}`
3. `CredentialsManager(server_url="https://your-server.example.com")`
4. `CredentialsManager(service_account_path="/path/to/service-account.json")`

## Programmatic Usage

```python
from extrasuite.client import CredentialsManager

manager = CredentialsManager(server_url="https://your-server.example.com")

credential = manager.get_credential(
    command={"type": "sheet.pull", "file_url": "https://docs.google.com/..."},
    reason="User asked to inspect the spreadsheet",
)

print(credential.kind)
print(credential.service_account_email)
print(credential.expires_in_seconds())
```

## Session Flow

1. `CredentialsManager` opens `GET /api/token/auth?port=<port>` in the browser when no valid session exists
2. The browser is redirected to localhost with a short-lived auth code
3. The client exchanges that code at `POST /api/auth/session/exchange`
4. The returned session token is stored in `~/.config/extrasuite/session.json`
5. Each command exchanges the session token at `POST /api/auth/token`

Credential cache files are stored under `~/.config/extrasuite/credentials/`.

## Service Account Mode

For non-interactive environments:

```python
from extrasuite.client import CredentialsManager

manager = CredentialsManager(service_account_path="/path/to/service-account.json")
```

This mode requires:

```bash
pip install google-auth
```
