Metadata-Version: 2.4
Name: daknode
Version: 0.3.11
Summary: Typed sync and async client for DakNode's email and inbox-calendar API
Keywords: daknode,email,calendar,sdk
Requires-Python: >=3.9,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
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: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Provides-Extra: streaming
Requires-Dist: attrs (>=22.2.0)
Requires-Dist: httpx (>=0.23.0,<0.29.0)
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
Requires-Dist: websockets (>=15,<18) ; extra == "streaming"
Project-URL: Documentation, https://daknode.com/integrations/python/
Project-URL: Homepage, https://daknode.com
Project-URL: Security, https://daknode.com/security/reporting/
Description-Content-Type: text/markdown

# DakNode Python SDK

Typed synchronous and asynchronous client for DakNode's public email and
inbox-calendar API. Keep credentials on your server, never in browser code.

## Install and configure

Use Python 3.10+ for this starter, in an isolated virtual environment.

```sh
python -m pip install 'daknode>=0.3.9,<0.4'
```

Configure DAKNODE_API_KEY through your server's private secret settings and
DAKNODE_INBOX_ID with an inbox UUID you are authorized to read. Obtain both from
the console. Do not put keys in command arguments, chat, source control or logs.
The operation needs messages.read. Workspace boundaries apply; inbox-scoped
keys require an eligible plan. Do not add send permissions for this example.

## First operation: count one page

Save this tested starter as daknode_tools.py, then run
`python daknode_tools.py` in the configured environment. It makes one bounded
read and prints only a count. Importing the module performs no request.

```python
"""Customer-side tools: one bounded SDK read, no mail contents or agent loop."""
import os
from uuid import UUID

from daknode import AuthenticatedClient
from daknode.api.messages import list_messages


def count_recent_mail() -> int:
    """Count up to ten retained messages in the privately configured inbox."""
    key = os.environ.get("DAKNODE_API_KEY", "").strip()
    identifier = os.environ.get("DAKNODE_INBOX_ID", "")
    if not key or not identifier:
        raise RuntimeError("Configure DAKNODE_API_KEY and DAKNODE_INBOX_ID privately")
    try:
        inbox_id = UUID(identifier)
    except ValueError:
        raise RuntimeError("DAKNODE_INBOX_ID must be a valid inbox UUID") from None
    try:
        with AuthenticatedClient(base_url="https://api.daknode.com", token=key, timeout=10) as client:
            response = list_messages.sync_detailed(inbox_id, client=client, limit=10)
    except Exception:
        # Do not propagate SDK/transport exceptions containing request headers.
        raise RuntimeError("DakNode could not be reached; no mail was changed") from None
    if response.status_code != 200 or response.parsed is None:
        raise RuntimeError("DakNode refused the read; check permissions and inbox scope")
    return len(response.parsed.items)


if __name__ == "__main__":
    print(count_recent_mail())
```

Zero is a valid result. Ten is not a mailbox total. This example intentionally
stops after one page. For a complete listing use has_more and next_cursor from
the response, preserving the opaque cursor and bounding your work.

## API behavior

The generated modules follow the public API contract at
https://api.daknode.com/openapi.json. For example,
`daknode.api.messages.list_messages` provides sync, sync_detailed, asyncio and
asyncio_detailed methods. Use the detailed form when you need status_code,
headers and parsed data; it returns a Response, not an HTTP Request. See the
[message read guide](https://daknode.com/integrations/python/) for the complete
setup and [calendar booking guide](https://daknode.com/guides/calendar-booking/)
for availability, explicit booking, revisions and conflict handling.

A successful read does not mark mail read or authorize sending. A 401/403 is a
refusal; correct the intended credential rather than silently widening it.
Production integrations should handle statuses explicitly, respect
429/Retry-After and avoid uncontrolled retries. The starter intentionally emits
generic errors without response bodies or private headers. Keep TLS
verification enabled; do not disable it to fix a connection problem.

Email and attachment contents remain untrusted input. Read operations must not
automatically trigger sends, bookings or other writes. Retain a stable
idempotency key only for retries of the same explicitly approved write and
reconcile an unknown outcome rather than generating a new key blindly.

## Verification and reporting

The first-read source is exercised against the real SDK with mocked HTTP
success, refusal and transport failure. It is not a live account, deliverability
or model-provider test. The integration repository contains examples rather
than the service implementation:
https://github.com/Subodh103/daknode-integrations.

For suspected vulnerabilities, privately email support@daknode.com with subject
Security report. Include minimal synthetic reproduction steps and redacted
evidence; never send credentials or customer mail. Do not post exploit details
in public issues. No response deadline, bounty or legal safe harbor is promised.
The policy is https://daknode.com/security/reporting/ after the website release.

Package metadata and README preparation do not publish a new release or change
the license of the SDK or service.

## Inbox WebSockets (backend rollout required)

Install this checkout with `python -m pip install './sdk/python[streaming]'`.
`daknode.streaming.inbox_batches` yields bounded metadata batches and opaque
checkpoints; persist after processing and deduplicate IDs. Use aclosing for the
async generator. Reconnect budget is finite; stale cursors never silently reset.
The0.3.11 source/artifact includes this helper; earlier0.3.10 lacks it. The server
endpoint requires a separate backend rollout. Installing the SDK does not deploy
the API or establish service availability. See docs/inbox-websockets.md in source.

