Skip to main content

Sangho Python SDK

SDK officiel Python pour l'API Sangho — paiements XAF pour l'Afrique.

PyPI version CI License: MIT


Installation

pip install sangho

Quickstart

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 :

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

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.

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.

Changelog

Voir CHANGELOG.md.

Licence

MIT

Metadata

Release files for sangho 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sangho 0.1.4
File Size Uploaded
sangho-0.1.4.tar.gz 36.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sangho 0.1.4
File Interpreter ABI Platform
sangho-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 77.8 kB

Release files / sangho-0.1.4.tar.gz

Download URL sangho-0.1.4.tar.gz
Size 36.0 kB
Tags Source
SHA-256 checksum
How to use checksums
93414ed73f55a7eba0dd1319d2df2caa75bd78ab1f3d36d936900d3dfea8c782
BLAKE2b-256 checksum
How to use checksums
e68197fc0db163e79abbe9a265773724e4288316647f250fb3f64716a82569c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / sangho-0.1.4-py3-none-any.whl

Download URL sangho-0.1.4-py3-none-any.whl
Size 41.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
482ec67cfc491b8578ecca48ccd0dc88b52ae8c93a939fd36bd8e3b24d4a7d64
BLAKE2b-256 checksum
How to use checksums
1b8f65d35fbe0b4eaf777dd09b70a2c9327c346fce041a92b3b941535b4261ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page