core.sms_processor ================== .. py:module:: core.sms_processor .. autoapi-nested-parse:: Send SMS through ASPSMS Adapted from `repoze.sendmail`_. Usage:: qp = SmsQueueProcessor(sms_directory) qp.send_messages() Attributes ---------- .. autoapisummary:: core.sms_processor.log core.sms_processor.MAX_SEND_TIME Classes ------- .. autoapisummary:: core.sms_processor.SmsQueueProcessor Functions --------- .. autoapisummary:: core.sms_processor.get_sms_queue_processor Module Contents --------------- .. py:data:: log .. py:data:: MAX_SEND_TIME :value: 10800 .. py:class:: SmsQueueProcessor(path: str, username: str, password: str, originator: str | None = None) .. py:attribute:: path .. py:attribute:: username .. py:attribute:: password .. py:attribute:: originator :value: 'OneGov' .. py:attribute:: url :value: 'https://json.aspsms.com/SendSimpleTextSMS' .. py:attribute:: curl .. py:method:: split(filename: str) -> tuple[str, str, str] Returns the path, the name and the suffix of the given path. .. py:method:: message_files() -> tuple[str, Ellipsis] Returns a tuple of full paths that need processing. The file names in the directory usually look like this: * 0.1571822840.745629 * 1.1571822743.595377 The part before the first dot is the batch number the rest is the timestamp at time of calling app.send_sms. The messages are sorted by suffix, so by default the sorting happens from oldest to newest message. .. py:method:: send(numbers: collections.abc.Sequence[str], content: str) -> dict[str, Any] | None Sends the SMS and returns the API response on error. On success this returns None. .. py:method:: send_request(parameters: onegov.core.types.JSON_ro) -> tuple[int, str] Performes the API request using the given parameters. .. py:method:: parse(filename: str) -> tuple[tuple[str, Ellipsis] | None, str | None] .. py:method:: send_messages() -> None .. py:method:: send_message(filename: str) -> None .. py:function:: get_sms_queue_processor(app: onegov.core.framework.Framework, missing_path_ok: bool = False) -> SmsQueueProcessor | None