expephalon-demomodule/core/classes/sms.py
2020-04-13 12:08:59 +02:00

33 lines
No EOL
1 KiB
Python

from typing import Union
class SMSNotSent(Exception):
'''SMS providers must raise SMSNotSent if an SMS was reported as not sent by the gateway.'''
class BaseSMSProvider:
'''SMS providers must be subclasses of BaseSMSProvider and implement at least is_active and sendSMS().'''
@property
def get_name(self):
return "Base SMS Provider"
@property
def get_logo(self):
return ""
@property
def is_active(self):
'''Returns True if the provider is properly configured and ready to use.'''
raise NotImplementedError(f"{type(self)} does not implement is_active!")
@property
def get_edit_url(self):
return
def sendSMS(self, recipients: Union[str, list], message: str):
'''Send an SMS message to one or more recipients
:param recipients: Recipient phone number as a string, or a list of multiple phone number strings
:param message: Message to be sent as a string
'''
raise NotImplementedError(f"{type(self)} does not implement sendSMS()!")