gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
This commit is contained in:
1
core/http/tasks/__init__.py
Normal file
1
core/http/tasks/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .sms import * # noqa
|
||||
25
core/http/tasks/sms.py
Normal file
25
core/http/tasks/sms.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
Base celery tasks
|
||||
"""
|
||||
|
||||
from celery import shared_task
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from core.services import sms_service
|
||||
from core.utils import console
|
||||
|
||||
|
||||
@shared_task
|
||||
def SendConfirm(phone, code):
|
||||
try:
|
||||
service: sms_service.SendService = sms_service.SendService()
|
||||
service.send_sms(
|
||||
phone, _("Sizning Tasdiqlash ko'dingiz: %(code)s") % {"code": code}
|
||||
)
|
||||
console.Console().success(f"Success: {phone}-{code}")
|
||||
except Exception as e:
|
||||
console.Console().error(
|
||||
"Error: {phone}-{code}\n\n{error}".format(
|
||||
phone=phone, code=code, error=e
|
||||
)
|
||||
) # noqa
|
||||
Reference in New Issue
Block a user