first commit

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
chelsea
2026-07-04 04:39:53 +00:00
commit db5bde0a70
13 changed files with 1095 additions and 0 deletions

26
sms/exceptions.py Normal file
View File

@@ -0,0 +1,26 @@
"""Exception hierarchy for the voip.ms SMS client."""
class VoipMsError(Exception):
"""Base error for any failure talking to the voip.ms API."""
class VoipMsAuthError(VoipMsError):
"""Authentication / IP-whitelist problem reported by voip.ms."""
class VoipMsApiError(VoipMsError):
"""voip.ms returned a non-success `status` in the response body."""
def __init__(self, message: str, code: str | None = None) -> None:
super().__init__(message)
self.code = code
class VoipMsRateLimitError(VoipMsError):
"""Local daily-send guard refused the request before it was sent."""
def __init__(self, message: str, *, limit: int, used_today: int) -> None:
super().__init__(message)
self.limit = limit
self.used_today = used_today