Metadata-Version: 2.4
Name: wearlink
Version: 0.1.0
Summary: Official Python SDK for WearLink — unified connected-health data API.
Author-email: WearLink <hello@wearlink.io>
License: MIT
Project-URL: Homepage, https://wearlink.io
Project-URL: Documentation, https://wearlink.io/docs
Project-URL: Repository, https://github.com/wearlink/wearlink
Project-URL: Issues, https://github.com/wearlink/wearlink/issues
Keywords: wearlink,health,wearables,garmin,oura,fitbit,whoop,strava,healthkit
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 :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.5
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-httpx>=0.30; extra == "dev"

# wearlink

Official Python SDK for [WearLink](https://wearlink.io) — a unified connected-health data API for Garmin, Oura, Fitbit, WHOOP, Polar, Strava, Apple Health, Google Fit, and Samsung Health.

## Install

```bash
pip install wearlink
```

Requires Python 3.10+.

## Quick start

```python
from wearlink import WearLinkClient

wl = WearLinkClient(api_key="sk-...")

user = wl.users.create({"external_user_id": "abc-123", "email": "jane@example.com"})
token = wl.sdk.create_user_token(user.id, app_id="com.example.myapp")

workouts = wl.data.workouts(
    user.id,
    start="2026-04-01T00:00:00Z",
    end="2026-04-30T23:59:59Z",
)
for w in workouts:
    print(w.type, w.start_datetime, w.duration_seconds)
```

## Webhook signature verification

```python
from flask import Flask, request, abort
from wearlink import verify_webhook_signature

app = Flask(__name__)

@app.post("/webhooks/wearlink")
def handle_webhook():
    ok = verify_webhook_signature(
        request.get_data(),
        request.headers.get("x-webhook-signature"),
        secret=os.environ["WEARLINK_WEBHOOK_SECRET"],
    )
    if not ok:
        abort(401)
    event = request.get_json()
    # handle event["type"] ...
    return "", 200
```

## Error handling

All non-2xx responses raise `WearLinkError`:

```python
from wearlink import WearLinkError

try:
    wl.users.get("nope")
except WearLinkError as err:
    print(err.status, err.detail)
```

## Context manager

```python
with WearLinkClient(api_key="sk-...") as wl:
    users = wl.users.list(limit=100)
```

## License

MIT
