chatbotAPI / src /controllers /auth /otp_controller.py
dhruv4023's picture
Synced repo using 'sync_with_huggingface' Github Action
a3386d3 verified
raw
history blame contribute delete
823 Bytes
from fastapi import APIRouter, Request
from src.config.appConfig import ENV_VAR
from src.helpers.response import ResponseHandler
from src.helpers.send_request import sendRequest
router = APIRouter()
AUTH_API_END = ENV_VAR.AUTH_API_END
@router.post("/send-otp")
async def send_otp_controller(req: Request):
try:
# Make the request to the authentication API endpoint
response = sendRequest(
f"{AUTH_API_END}/api/v1/mail/send-otp",
"post",
req,
None,
{"Content-Type": "application/json"},
)
# Handle the response using the ResponseHandler
return ResponseHandler.success_mediator(response)
except Exception as e:
# Log and handle any exceptions
print(e)
return ResponseHandler.error(9999, e)