Files
Rasadyar_Kurdestan/LiveStock/sms_management.py
2026-01-18 11:59:48 +03:30

30 lines
1.1 KiB
Python

import requests
from LiveStock.models import Cooperative
from authentication.sahandsms.sms import USERNAME_SMS, PASSWORD_SMS, USERNAME_SMS_FINANCIAL, PASSWORD_SMS_FINANCIAL
from panel.helper import check_mobile_number
def send_sms_for_cooperative(request):
cooperative=Cooperative.objects.filter(trash=False)
for c in cooperative:
mobile=c.user.mobile
password=c.user.password
message = 'کاربر گرامی' \
f'\n' \
f'اطلاعات کاربری شما در سامانه به شرح زیر میباشد:' \
f'\n' \
f'\n' \
f'نام کاربری: {mobile}' \
f'\n' \
f'رمز عبور: {password}' \
f'\n' \
f'(سامانه رصدیار)' \
check_mobile = check_mobile_number(mobile)
if check_mobile:
u = "http://webservice.sahandsms.com/newsmswebservice.asmx/SendPostUrl?username={}&password={}&from=30002501&to={}&message={}".format(
USERNAME_SMS, PASSWORD_SMS,
mobile, message)