پکیج رسمی ارسال پیامک پیشرو پیامک برای پایتون
Project description
📱 پکیج رسمی پیشرو پیامک برای پایتون
پکیج رسمی پیشرو پیامک برای ارسال آسان پیامک در پروژههای پایتون.
✨ ویژگیها
- ارسال پیامک با احراز هویت توکن
- ارسال گروهی به چندین گیرنده
- پشتیبانی از پیامک معمولی و فلش
- دریافت کد پیگیری
- مدیریت خطاهای حرفهای
- تست شده و قابل اطمینان
📦 نصب
pip install pishropayamak-sms
🚀 استفاده
روش اول: استفاده از کلاس اصلی
python
from pishropayamak_sms import SmsService
sms_service = SmsService('your_token_here')
result = sms_service.send_sms(
from_number='9444xxxxxx',
recipients=['09121234567'],
message='سلام! به پیشرو پیامک خوش آمدید.'
)
if result['success']:
print(f"کد پیگیری: {result['id']}")
else:
print(f"خطا: {result['error']}")
ارسال گروهی
python
result = sms_service.send_sms(
from_number='9444xxxxxx',
recipients=['09121234567', '09129876543', '09123456789'],
message='تخفیف ویژه تا ۲۴ ساعت دیگر!'
)
ارسال پیام فلش
python
result = sms_service.send_sms(
from_number='9444xxxxxx',
recipients=['09121234567'],
message='پیام فوری!',
msg_type=1 # نوع فلش
)
📝 پارامترهای متد send_sms
پارامتر نوع ضروری توضیح
from_number str بله شماره فرستنده (خط اختصاصی)
recipients List[str] بله لیست شماره گیرندگان
message str بله متن پیامک
msg_type int خیر 0=معمولی، 1=فلش
🔧 مدیریت خطاها
python
from pishropayamak_sms import SmsService
from pishropayamak_sms.exceptions import (
AuthenticationError,
NetworkError,
SendError,
ValidationError
)
try:
result = sms_service.send_sms(...)
except ValidationError as e:
print(f"خطای اعتبارسنجی: {e}")
except AuthenticationError as e:
print(f"خطای احراز هویت: {e}")
except NetworkError as e:
print(f"خطای شبکه: {e}")
except SendError as e:
print(f"خطای ارسال: {e}")
🔒 نکات امنیتی
توکن را در کد قرار ندهید! از متغیرهای محیطی استفاده کنید.
همیشه از HTTPS برای ارتباط استفاده کنید.
توکن را بهطور دورهای تمدید کنید.
🌐 وبسایت رسمی
https://pishropayamak.ir
🔗 مخزن گیتهاب
https://github.com/MohammadrezaRahpeyma/pishropayamak-python-sms
📄 مجوز
این پکیج تحت مجوز 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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
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 pishropayamak_sms-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pishropayamak_sms-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f521cac94e99bf4b405e50d8e94ddc1ad820a3270a5e3ee2f86919d2df631cad
|
|
| MD5 |
78932add1a4f00f34cb02435301e8d83
|
|
| BLAKE2b-256 |
3aa6b20ca5b4f4a45e278193a54b8e198fb1f46225e634ce102fb06f970922c3
|