Metadata-Version: 2.4
Name: otp-sanly
Version: 1.0.0
Summary: Official Python SDK for OTP Sanly (otp.sanly.dev) — SMS & Email OTP for Turkmenistan
Author: OTP Sanly
License: MIT
Project-URL: Homepage, https://otp.sanly.dev/developers
Project-URL: Repository, https://github.com/sanly-dev/otp-sanly-python
Project-URL: Issues, https://github.com/sanly-dev/otp-sanly-python/issues
Keywords: otp,sms,email,verification,turkmenistan,2fa,authentication
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# OTP Sanly — Python SDK

[Türkmençe](README.tk.md) | [Русский](README.ru.md) | English

Official SDK for [OTP Sanly](https://otp.sanly.dev) — SMS & Email OTP authentication for Turkmenistan.

## Install

```bash
pip install otp-sanly
```

## Quick start

```python
from otp_sanly import OtpSanly

sanly = OtpSanly(api_key="YOUR_API_KEY")

# Send an OTP
sent = sanly.send_otp(
    phone="+99361234567",  # Turkmenistan numbers only for SMS. Use `email=` instead for worldwide delivery.
    project="My App",
    lang="ru",  # "tk" | "ru" | "en" — which language to send the OTP in
)
print(sent.otp_id, sent.message)

# Verify the code the user entered
verified = sanly.verify_otp(phone="+99361234567", code="123456")
if verified.success:
    ...  # proceed — the code was correct
```

## Sandbox mode

Create a **sandbox** API key in your [dashboard](https://otp.sanly.dev/dashboard/api-keys) to test your integration
for free, without sending real SMS/email. The OTP code is returned directly in the response:

```python
sent = sanly.send_otp(phone="+99361234567")
print(sent.code)  # only present for sandbox keys
```

## Error handling

Failed requests raise `OtpSanlyError`, which includes the HTTP status and the raw response body:

```python
from otp_sanly import OtpSanly, OtpSanlyError

try:
    sanly.send_otp(phone="+99361234567")
except OtpSanlyError as err:
    print(err.status, err, err.body)
```

## Full API reference

See [https://otp.sanly.dev/developers](https://otp.sanly.dev/developers) for the complete API reference, webhook docs,
and framework-specific examples in other languages.

## License

MIT
