Metadata-Version: 2.5
Name: shopbird
Version: 0.1.0
Summary: Official Python client for the Shopbird API: locks, audiences, codes, drops and webhook verification.
Project-URL: Homepage, https://shopbird.app
Project-URL: Documentation, https://shopbird.app/docs/sdk-python
Author-email: Atomi Design LLC <support@shopbird.app>
License-Expression: MIT
License-File: LICENSE
Keywords: drops,locks,shopbird,shopify,standard-webhooks,webhooks
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# shopbird

The official Python client for the [Shopbird](https://shopbird.app) API. It covers locks, audiences, codes, drops, sync and webhook signatures.

No dependencies. It needs Python 3.9 or later.

```bash
pip install shopbird
```

## Use it

Create a token in Shopbird under **Settings > API access** and put it in `SHOPBIRD_TOKEN`.

```python
from shopbird import Shopbird

shopbird = Shopbird()

for lock in shopbird.locks.list():
    print(lock["name"])

lock = shopbird.locks.create(
    {"name": "VIP", "targets": [{"type": "product", "resource_id": "gid://shopify/Product/123"}], "audience_ids": ["<audience id>"]},
    wait=True,
)
shopbird.locks.update(lock["id"], {"name": "VIP only"}, version=lock["version"])
```

## Verify webhooks

```python
from shopbird import verify_webhook

delivery = verify_webhook(raw_body, headers, os.environ["SHOPBIRD_WEBHOOK_SECRET"])
if delivery.event["type"] == "drop.stage_changed":
    print(delivery.event["data"]["to"])
```

Full guide: https://shopbird.app/docs/sdk-python. API reference: https://shopbird.app/docs.

## Develop

This package lives in `sdk-python/` of the Shopbird repository. Run the tests with `PYTHONPATH=src python -m unittest discover -s tests`. `tests/test_contract.py` fails when an API route has no SDK method. Releases: `docs/operations/sdk-release.md`.
