Metadata-Version: 2.4
Name: clawpro
Version: 0.2.0
Summary: Official Python SDK for the ClawPro Instagram outbound API.
Project-URL: Homepage, https://tryclawpro.com
Project-URL: Repository, https://github.com/Bojale-Labs/clawpro-python
Author: ClawPro
License-Expression: MIT
License-File: LICENSE
Keywords: clawpro,dm,instagram,outbound,sdk,tryclawpro
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.8
Requires-Dist: httpx>=0.24
Description-Content-Type: text/markdown

# clawpro

Official Python SDK for the **ClawPro** Instagram outbound API — connect sending accounts, run competitor-audience campaigns, score leads, manage webhooks, and read usage.

```bash
pip install clawpro
```

Python 3.8+. Get an API key from the [developer portal](https://tryclawpro.com) → **API & Developers → API Keys**.

## Quick start

```python
import os
from clawpro import ClawPro, ClawProError

clawpro = ClawPro(api_key=os.environ["CLAWPRO_API_KEY"])

account = clawpro.accounts.create(username="burner_account", country="gb")

campaign = clawpro.campaigns.create(
    account_id=account["id"],
    name="Founders engaging with X",
    targets=["@influencer1"],
    offer="We help B2B founders book demos via Instagram outbound.",
    daily_dm_target=20,
)
clawpro.campaigns.run(campaign["id"])

# Warm replies → mark a lead booked (fires the lead.booked webhook)
inbox = clawpro.campaigns.inbox(campaign["id"])
if inbox:
    clawpro.leads.update(inbox[0]["id"], status="booked")

print(clawpro.usage.summary())

# Auto-paginate the request log
for log in clawpro.usage.iterate_logs(page_size=100):
    ...
```

## Resources

`accounts`, `campaigns`, `leads`, `webhooks`, `keys`, `usage` — mirroring the REST API. Requests authenticate with `X-API-Key`; transient failures (network, `429` honoring `Retry-After`, `5xx`) are retried with exponential backoff for idempotent calls.

## Errors

```python
try:
    clawpro.accounts.create(username="taken_handle")
except ClawProError as err:
    print(err.status, err, err.request_id)  # 409 "@taken_handle is already connected"
```

## Configuration

```python
ClawPro(api_key="...", base_url="https://api.tryclawpro.com", max_retries=3, timeout=30.0)
```

It's also a context manager (`with ClawPro(...) as clawpro: ...`) and exposes `.close()`.

## License

MIT
