Desi-Clans/backend/app/services/outbound.py
2026-10-08 02:52:58 +05:30

10 lines
306 B
Python

from urllib.parse import urlparse
ALLOWED_SCHEMES = {"http", "https"}
def validate_outbound_url(url: str) -> str:
parsed = urlparse(url.strip())
if parsed.scheme not in ALLOWED_SCHEMES or not parsed.netloc:
raise ValueError("Only http and https URLs are allowed")
return url.strip()