Send OTPs, alerts, and notifications to North African carriers (**Mobilis**, **Djezzy**, **Ooredoo**) using our decentralized mesh network.
# GateWire Python SDK
The official Python library for the **GateWire SMS Infrastructure**.
Send OTPs to North African carriers (**Mobilis**, **Djezzy**, **Ooredoo**) using our
decentralized mesh network.
---
## Installation
```bash
pip install gatewire
```
Requires Python 3.10+ and `requests>=2.28`.
---
## Quick Start
```python
from gatewire import GateWireClient, GateWireException
gw = GateWireClient(api_key="YOUR_API_TOKEN")
# 1. Send OTP
res = gw.dispatch(phone="+213555123456", template_key="login_otp")
reference_id = res["reference_id"] # store this; you'll need it for verification
# 2. Verify the code the user entered
gw.verify_otp(reference_id=reference_id, code=user_input)
# 3. (Optional) Poll status yourself
info = gw.status(reference_id)
print(info["status"]) # pending | sent | verified | failed | expired
```
---
## API Reference
### `GateWireClient(api_key, base_url=...)`
Creates the client. A single `requests.Session` is opened and reused for all requests.
| Parameter | Type | Default | Description |
|------------|-------|-----------------------------------------------|--------------------|
| `api_key` | `str` | — | Your API token |
| `base_url` | `str` | `
gatewire.raystate.com` | Override for tests |
---
### `dispatch(phone, template_key=None) -> dict`
Send an OTP to a phone number.
| Parameter | Type | Required | Description |
|----------------|-----------------|----------|-------------------------------------------------------------------------------|
| `phone` | `str` | Yes | Recipient number in E.164 format (e.g. `+213555123456`) |
| `template_key` | `str` or `None` | No | Template key configured in the dashboard. Omit to use the default template. |
**Returns** `{"reference_id": …