Metadata-Version: 2.5
Name: sangho
Version: 0.1.4
Summary: SDK officiel Python pour l'API Sangho
Project-URL: Homepage, https://docs.sangho.ga/api/sdks/python/
Project-URL: Repository, https://github.com/sangho-sdks/sangho.python
Project-URL: Issues, https://github.com/sangho-sdks/sangho.python/issues
Project-URL: Changelog, https://github.com/sangho-sdks/sangho.python/blob/main/CHANGELOG.md
Author-email: Sangho <nels.holy.allg@gmail.com>
License: MIT
License-File: LICENSE
Keywords: afrique,mobile-money,payments,python,sangho,sdk,xaf
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Requires-Dist: twine>=5.0; extra == 'dev'
Description-Content-Type: text/markdown

# Sangho Python SDK

SDK officiel Python pour l'API [Sangho](https://sangho.ga) — paiements XAF pour l'Afrique.

[![PyPI version](https://badge.fury.io/py/sangho.svg)](https://badge.fury.io/py/sangho)
[![CI](https://github.com/sangho-sdks/sangho.py/actions/workflows/ci.yml/badge.svg)](https://github.com/sangho-sdks/sangho.py/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

---

## Installation

```bash
pip install sangho
```

## Quickstart

```python
import sangho

client = sangho.Sangho("sk_prod_...")

# Créer un payment intent
intent = client.payment_intents.create(
    amount=5000,
    customer="cust_xxx",
    currency="XAF",
)

print(intent["id"])
```

## Async

Chaque appel devient une coroutine — utile sous FastAPI/aiohttp/asyncio :

```python
import asyncio
from sangho import AsyncSangho

async def main():
    async with AsyncSangho("sk_prod_...") as client:
        intent = await client.payment_intents.create(
            amount=5000,
            customer="cust_xxx",
            currency="XAF",
        )
        print(intent["id"])

asyncio.run(main())
```

## Gestion des erreurs

```python
import sangho

try:
    intent = client.payment_intents.create(amount=5000, customer="cust_xxx")
except sangho.error.AuthenticationError:
    print("Clé API invalide")
except sangho.error.RateLimitError as e:
    print("Trop de requêtes, retenter après", e.retry_after, "s")
except sangho.error.InvalidRequestError as e:
    print(e.param, e.message)
except sangho.error.SanghoError as e:
    print(e.code, e.message, e.status_code)
```

`sangho.error.*` sont des alias des classes `sangho.SanghoXxxError` (mêmes
exceptions, deux chemins d'import) : `except sangho.error.AuthenticationError`
et `except sangho.SanghoAuthError` interceptent exactement la même erreur.

## Documentation

La documentation complète est disponible sur [docs.sangho.ga/api/sdks/python](https://docs.sangho.ga/api/sdks/python/).

## Ressources disponibles

`account` · `addresses` · `apps` · `customers` · `products` · `payment_intents` ·
`checkout_sessions` · `invoices` · `transactions` · `refunds` · `subscriptions` ·
`payment_methods` · `receipts` · `webhooks` · `payment_links` · `security` ·
`partners` · `terminal` · `sandbox`

## Contribuer

Voir [CONTRIBUTING.md](CONTRIBUTING.md).

## Changelog

Voir [CHANGELOG.md](CHANGELOG.md).

## Licence

MIT
