first commit

This commit is contained in:
A'zamov Samandar
2025-11-21 14:41:16 +05:00
commit 256e80cc23
161 changed files with 7052 additions and 0 deletions

View File

@@ -0,0 +1 @@
from .sms import * # noqa

View File

@@ -0,0 +1,38 @@
#type: ignore
"""
Base celery tasks
"""
import logging
import os
from importlib import import_module
from celery import shared_task
from config.env import env
from django.utils.translation import gettext as _
@shared_task
def SendConfirm(phone, code):
"""Tasdiqlash ko'dini yuborish
Args:
phone (str, int): telefon no'mer
code (str, int): tasdiqlash ko'di
Raises:
Exception: [TODO:description]
"""
try:
service = getattr(
import_module(os.getenv("OTP_MODULE")), os.getenv("OTP_SERVICE")
)()
service.send_sms(
phone, env.str("OTP_MESSAGE", _("Sizning Tasdiqlash ko'dingiz: %(code)s")) % {"code": code}
)
logging.info("Sms send: %s-%s" % (phone, code))
except Exception as e:
logging.error(
"Error: {phone}-{code}\n\n{error}".format(phone=phone, code=code, error=e)
) # noqa
raise Exception