The first and best OTP sending package on the 'Bale' messenger
Project description
BaleOTP
BaleOTP is a Python asynchronous client for sending OTPs (One-Time Passwords) through the Bale AI OTP API.
Features
- Fetches and refreshes access tokens automatically
- Sends OTPs to Iranian mobile numbers
- Fully asynchronous using
aiohttp - Handles all documented error responses
- Accepts various phone number formats (e.g., 0912..., 98912..., +98912...)
- Supports both
intandstrformat OTPs - Customizable base URL for different environments (e.g., test/staging)
Installation
pip install baleotp
Usage
from baleotp import OTPClient
client = OTPClient("your_client_id", "your_client_secret")
response = client.send_otp("09123456789", 123456)
print(response)
Or with await (inside async code):
import asyncio
from baleotp import OTPClient
async def main():
client = OTPClient("your_client_id", "your_client_secret")
result = await client.send_otp("09123456789", 123456)
print(result)
asyncio.run(main())
License
MIT
BaleOTP یک کلاینت پایتونی غیرهمزمان برای ارسال رمزهای یکبار مصرف (OTP) از طریق API بله است.
قابلیتها
- دریافت و تمدید خودکار توکن احراز هویت
- ارسال OTP به شمارههای موبایل ایران
- طراحی کامل با استفاده از
aiohttp - مدیریت تمام خطاهای اعلامشده در مستندات
- تشخیص و اصلاح فرمت شمارهها (۰۹، ۹۸، +۹۸ و...)
- پشتیبانی از OTP به صورت عدد (
int) یا رشته (str) - امکان تعیین آدرس دلخواه (base URL) برای تست یا محیطهای دیگر
نصب
pip install baleotp
مثال استفاده
from baleotp import OTPClient
client = OTPClient("UserName", "PassWord")
response = client.send_otp("09123456789", 123456)
print(response)
یا به صورت async:
import asyncio
from baleotp import OTPClient
async def main():
client = OTPClient("UserName", "PassWord")
result = await client.send_otp("09123456789", 123456)
print(result)
asyncio.run(main())
مجوز
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file baleotp-0.0.2.tar.gz.
File metadata
- Download URL: baleotp-0.0.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7c514b7dfdfbefbd558a603617feb1dbb23ab45493d04b60f7361cb71c8955d
|
|
| MD5 |
adef7d1432a091825ac9ed04daae6d27
|
|
| BLAKE2b-256 |
c8b67440a1a17d66def869738a4e89b30d165c359659243379c49e97aba48e42
|
File details
Details for the file baleotp-0.0.2-py3-none-any.whl.
File metadata
- Download URL: baleotp-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
188199ee9645ae6d92132be7267d2e0073330f261ee998ac6d80a34bd2ec0f36
|
|
| MD5 |
6d3e92827b05f1a9ae23fc127641ae3a
|
|
| BLAKE2b-256 |
109401de387061f0f39895aefb621ca1988f8b564eeb8d1bf00af24527acba29
|