Metadata-Version: 2.4
Name: egotg
Version: 0.1.0
Summary: ego.tg — SMS Aggregation SDK. One API, every SMS provider.
License: MIT
Project-URL: Homepage, https://ego.tg
Project-URL: Documentation, https://ego.tg/api
Project-URL: Repository, https://github.com/egotg/python-sdk
Keywords: sms,verification,otp,virtual-number,ego.tg
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Communications :: Telephony
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28

# egotg

Official Python SDK for [ego.tg](https://ego.tg) — SMS aggregation platform. One API, every SMS provider.

## Install

```bash
pip install egotg
```

## Quick Start

```python
import egotg

client = egotg.Client("your_api_key")

# Get cheapest WhatsApp number
number = client.get_number(service="wa", country="auto")
print(f"Use this number: +{number.phone}")

# Wait for verification code
code = number.wait_for_code(timeout=120)
print(f"Got code: {code}")

# Done
number.complete()
```

## API

### Client

```python
client = egotg.Client("your_api_key")
client = egotg.Client("your_api_key", base_url="https://ego.tg/api")
```

### Account

```python
balance = client.balance()  # Returns float (USD)
```

### Services & Pricing

```python
services = client.services()       # [{"code": "tg", "name": "Telegram"}, ...]
countries = client.countries()     # {"22": {"id": "22", "eng": "India"}, ...}
prices = client.prices("tg")      # Sorted by price ascending
prices = client.prices("wa", country="22")  # Filter by country
```

### Buy Numbers

```python
# Auto-select cheapest country
number = client.get_number(service="tg", country="auto")

# Specific country
number = client.get_number(service="wa", country="22")

print(number.phone)    # "628123456789"
print(number.service)  # "wa"
print(number.status)   # "waiting"
```

### Wait for Code

```python
code = number.wait_for_code(timeout=120, interval=5)
# Polls every 5s for up to 120s, returns the code string
# Raises TimeoutError if no code received
```

### Complete / Cancel

```python
number.complete()           # Mark as used
refund = number.cancel()    # Cancel and get refund
```

### Error Handling

```python
from egotg import InsufficientBalance, NoNumbers, EgoError

try:
    number = client.get_number(service="tg")
except InsufficientBalance:
    print("Top up at https://ego.tg/payments")
except NoNumbers:
    print("Try a different service or country")
except EgoError as e:
    print(f"API error: {e}")
```

## Supported Services

190+ countries, 500+ services including:

| Code | Service |
|------|---------|
| `tg` | Telegram |
| `wa` | WhatsApp |
| `ig` | Instagram |
| `go` | Google |
| `tw` | Twitter/X |
| `fb` | Facebook |
| `mt` | Steam |
| `nf` | Netflix |
| `am` | Amazon |

## Links

- [Dashboard](https://ego.tg/dashboard)
- [API Docs](https://ego.tg/api)
- [Pricing](https://ego.tg/pricing)
