Skip to content

Conversation

Manodeepray
Copy link

This PR refactors the SMS sender FastAPI app for improved performance, validation, and error handling. Key changes:

An overal summary

  • Migrated from synchronous requests to asynchronous httpx.AsyncClient
  • Added input validation using pydantic.Field
  • Introduced async lifespan() for modern startup/shutdown handling
  • Improved error handling with detailed logs and structured JSONResponse
  • Updated requirements.txt

Changes i made

✅ Replaced requests.post with httpx.AsyncClient
✅ Updated endpoint to async def
✅ Added phone number pattern validation (+91... etc.)
✅ Introduced lifespan() for lifecycle management
✅ Added proper error responses with status codes
✅ Updated logging for Twilio and HTTP errors
✅ Created requirements.txt with minimal necessary deps

@pratik-mahalle
Copy link

Thank you for raising the pr, Our team will review the pr soon before that please make sure to sign the DCO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants