hooks¶
-
class
naz.hooks.BaseHook[source]¶ Bases:
abc.ABCInterface that must be implemented to satisfy naz’s hooks. User implementations should inherit this class and implement the
to_smscandfrom_smscmethods with the type signatures shown.A hook is class with methods that are called just before sending data to SMSC and just after receiving data from SMSC.
-
abstract async
from_smsc(smpp_command, log_id, hook_metadata, status, pdu)[source]¶ called after receiving data from SMSC.
- Parameters
smpp_command (
str) – any one of the SMSC commands eg submit_sm_resplog_id (
str) – an ID that a user’s application had previously supplied to naz to track/correlate different messages.hook_metadata (
str) – a string that a user’s application had previously supplied to naz that it may want to be correlated with the log_id.status (state.CommandStatus) – the state of request/response from SMSC.
pdu (
bytes) – the full PDU as received from SMSC
- Return type
None
-
abstract async
to_smsc(smpp_command, log_id, hook_metadata, pdu)[source]¶ called before sending data to SMSC.
- Parameters
smpp_command (
str) – any one of the SMSC commands eg submit_smlog_id (
str) – an ID that a user’s application had previously supplied to naz to track/correlate different messages.hook_metadata (
str) – a string that a user’s application had previously supplied to naz that it may want to be correlated with the log_id.pdu (
bytes) – the full PDU as sent to SMSC
- Return type
None
-
abstract async
-
class
naz.hooks.SimpleHook(logger=None)[source]¶ Bases:
naz.hooks.BaseHookThis is an implementation of BaseHook. When this class is called by naz, it just logs the request or response.
-
__init__(logger=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
- Return type
None
-
async
from_smsc(smpp_command, log_id, hook_metadata, status, pdu)[source]¶ called after receiving data from SMSC.
- Parameters
smpp_command (
str) – any one of the SMSC commands eg submit_sm_resplog_id (
str) – an ID that a user’s application had previously supplied to naz to track/correlate different messages.hook_metadata (
str) – a string that a user’s application had previously supplied to naz that it may want to be correlated with the log_id.status (state.CommandStatus) – the state of request/response from SMSC.
pdu (
bytes) – the full PDU as received from SMSC
- Return type
None
-
async
to_smsc(smpp_command, log_id, hook_metadata, pdu)[source]¶ called before sending data to SMSC.
- Parameters
smpp_command (
str) – any one of the SMSC commands eg submit_smlog_id (
str) – an ID that a user’s application had previously supplied to naz to track/correlate different messages.hook_metadata (
str) – a string that a user’s application had previously supplied to naz that it may want to be correlated with the log_id.pdu (
bytes) – the full PDU as sent to SMSC
- Return type
None
-