llama.files.sms_receipts module¶
FileHandlers that send SMS messages for high-priority human-in-the-loop alerts.
You will need to configure certain environmental variables to let LLAMA know how to send messages to the outside world.
If you have not specified your twilio credentials, you will see the following message in your warnings (which are usually supressed for optional features like this), and if you try to send out SMS uploads, you’ll see the following as the error message explaining why file generation failed:
Twilio API credentials are not configured;
you will not be able to submit text message notifications until this
is fixed.
Please fill in your Twilio API credentials in e.g. your .bashrc, which should
look something like the following (where ``PLACEHOLDER`` has obviously been
replaced with your actual authentication information):
export TWILIO_ACCOUNT_SID=PLACEHOLDER
export TWILIO_AUTH_TOKEN=PLACEHOLDER
export TWILIO_NUMBER=2407432233
If you have not specified phone numbers with which to contact team members, you will see the following message in your warnings and errors:
You must specify phone numbers in a JSON format in
the environmental variable LLAMA_PHONE_NUMBERS in order to send SMS
receipts. Your phonebook should be defined in your .bashrc or somewhere similar
like:
export LLAMA_PHONE_NUMBERS='[
{
"phone_number": "+395555555555",
"name": "John Smith"
},
{
"phone_number": "+12345678900",
"name": "Jane Doe"
}
]'
You will need to specify environmental variables with the missing configuration data as described above in order to use SMS receipts.
-
class
llama.files.sms_receipts.
MessageClient
¶ Bases:
object
A client for actually sending messages using Twilio’s api, modified from their example app.
-
send_message
(body, recipient)¶ Send a text message.
- Parameters
body (str) – The body of the text message.
recipient (str) – The cell phone number of the recipient.
-
-
class
llama.files.sms_receipts.
RctSMSAdvokJSON
¶ Bases:
llama.files.sms_receipts.SMSReceipt
A log file created when alerting LLAMA team members of a new event that requires immediate attention.
-
DEPENDENCIES
= (<class 'llama.files.skymap_info.SkymapInfo'>, <class 'llama.files.advok.Advok'>)¶
-
FILENAME
= 'rct_sms_skymap_info.json.log'¶
-
MANIFEST_TYPES
= (<class 'llama.files.sms_receipts.RctSMSAdvokJSON'>,)¶
-
UPLOAD
¶ alias of
llama.files.skymap_info.SkymapInfo
-
UR_DEPENDENCIES
= (<class 'llama.files.skymap_info.SkymapInfo'>,)¶
-
UR_DEPENDENCY_TREE
= frozenset({<class 'llama.files.skymap_info.SkymapInfo'>})¶
-
property
message_for_team
¶ Must specify a formula for generating the message that the team receives.
-
-
class
llama.files.sms_receipts.
SMSReceipt
¶ Bases:
llama.com.utils.UploadReceipt
A log file created when a text message is sent out to team members.
-
FILENAME_FMT
= 'rct_sms_{}.log'¶
-
abstract property
message_for_team
¶ Must specify a formula for generating the message that the team receives.
-
classmethod
send_message_to_team
(body)¶ Send a text message to all team members.
-
classmethod
set_class_attributes
(subclass)¶ See
UploadReceipt.set_class_attributes
; this method additionally addsAdvok
to theDEPENDENCIES
list forsubclass
(if it is not already there).
-