Metadata-Version: 2.4
Name: safesmm
Version: 0.1.0
Summary: Dependency-free Python client for the SafeSMM SMM panel API v2 (orders, status, refill, balance).
Author-email: SafeSMM <safesmmnet@gmail.com>
License: MIT
Project-URL: Homepage, https://safesmm.net
Project-URL: Documentation, https://safesmm.net/api/docs
Project-URL: Source, https://github.com/safesmmnet/safesmm-api-examples
Keywords: smm,smm panel,smm api,social media marketing,reseller,safesmm
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# safesmm

A small, dependency-free Python client for the **SafeSMM API v2**, the reseller API of [SafeSMM (safesmm.net)](https://safesmm.net), an SMM panel for resellers and agencies.

It also works with any SMM panel that uses the standard API v2 format. Just pass a different `api_url`.

## Install

```bash
pip install safesmm
```

## Quick start

```python
from safesmm import SafeSMM, SafeSMMError

client = SafeSMM("YOUR_API_KEY")

print(client.balance())            # {'balance': '12.50', 'currency': 'USD'}

for s in client.services()[:5]:     # browse services
    print(s["service"], s["name"], s["rate"], s["min"], s["max"])

order = client.add_order(service=1, link="https://t.me/yourchannel", quantity=1000)
print(order)                        # {'order': 23501}

print(client.status(order["order"]))
# {'charge': '0.27', 'start_count': '3572', 'status': 'In progress', 'remains': '157', 'currency': 'USD'}
```

## All methods

| Method | API action | Notes |
|---|---|---|
| `balance()` | `balance` | Your balance and currency |
| `services()` | `services` | Full service list |
| `add_order(service, link, quantity, **extra)` | `add` | Extra fields such as `runs`, `interval` (drip-feed) |
| `status(order_id)` | `status` | One order |
| `multi_status([id1, id2])` | `status` | Several orders in one call |
| `refill(order_id)` | `refill` | Services with a refill period |
| `cancel([id1, id2])` | `cancel` | Where cancel is available |

Errors returned by the API (for example `Invalid API key.`) are raised as `SafeSMMError`:

```python
try:
    client.balance()
except SafeSMMError as e:
    print("API error:", e)
```

## Using another panel

```python
client = SafeSMM("KEY", api_url="https://example-panel.com/api/v2")
```

## Security tips

- Keep your API key in an environment variable, not in your code or Git history.
- For bots and scripts, consider a separate panel account with only the balance you need.

## Links

- SafeSMM website: https://safesmm.net
- API documentation: https://safesmm.net/api/docs
- More examples (PHP and Python): https://github.com/safesmmnet/safesmm-api-examples

## License

MIT
