Skip to main content

The first and best OTP sending package on the 'Bale' messenger

Project description

BaleOTP

PyPI version License Python Versions

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 int and str format 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baleotp-0.0.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baleotp-0.0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

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

Hashes for baleotp-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d7c514b7dfdfbefbd558a603617feb1dbb23ab45493d04b60f7361cb71c8955d
MD5 adef7d1432a091825ac9ed04daae6d27
BLAKE2b-256 c8b67440a1a17d66def869738a4e89b30d165c359659243379c49e97aba48e42

See more details on using hashes here.

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

Hashes for baleotp-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 188199ee9645ae6d92132be7267d2e0073330f261ee998ac6d80a34bd2ec0f36
MD5 6d3e92827b05f1a9ae23fc127641ae3a
BLAKE2b-256 109401de387061f0f39895aefb621ca1988f8b564eeb8d1bf00af24527acba29

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page