From 7a822ff460cd910cd90895fa38785493417a36fc Mon Sep 17 00:00:00 2001 From: komuw Date: Thu, 28 Nov 2019 16:34:46 +0300 Subject: [PATCH 01/59] we are only throttled in two cases; ESME_RTHROTTLED and ESME_RMSGQFUL; thus treat all other cases as not throttled --- naz/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/naz/client.py b/naz/client.py index 89b9ed3c..7117b8af 100644 --- a/naz/client.py +++ b/naz/client.py @@ -2106,13 +2106,13 @@ async def command_handlers( try: # call throttling handler - if commandStatus.value == SmppCommandStatus.ESME_ROK.value: - await self.throttle_handler.not_throttled() - elif commandStatus.value in [ + if commandStatus.value in [ SmppCommandStatus.ESME_RTHROTTLED.value, SmppCommandStatus.ESME_RMSGQFUL.value, ]: await self.throttle_handler.throttled() + else: + await self.throttle_handler.not_throttled() except Exception as e: self._log( logging.ERROR, From 54e3005518f7832fe130c0df058ff247b446cd55 Mon Sep 17 00:00:00 2001 From: komuw Date: Thu, 28 Nov 2019 16:43:26 +0300 Subject: [PATCH 02/59] call users hook for response earlier --- naz/client.py | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/naz/client.py b/naz/client.py index 7117b8af..31d51edb 100644 --- a/naz/client.py +++ b/naz/client.py @@ -2125,6 +2125,27 @@ async def command_handlers( "state": commandStatus.description, }, ) + try: + # call user's hook for responses + await self.hook.from_smsc( + smpp_command=smpp_command, + log_id=log_id, + hook_metadata=hook_metadata, + status=commandStatus, + pdu=pdu, + ) + except Exception as e: + self._log( + logging.ERROR, + { + "event": "naz.Client.command_handlers", + "stage": "end", + "smpp_command": smpp_command, + "log_id": log_id, + "state": "from_smsc hook error", + "error": str(e), + }, + ) if smpp_command in [ SmppCommand.BIND_TRANSCEIVER, @@ -2263,28 +2284,6 @@ async def command_handlers( }, ) - # call user's hook for responses - try: - await self.hook.from_smsc( - smpp_command=smpp_command, - log_id=log_id, - hook_metadata=hook_metadata, - status=commandStatus, - pdu=pdu, - ) - except Exception as e: - self._log( - logging.ERROR, - { - "event": "naz.Client.command_handlers", - "stage": "end", - "smpp_command": smpp_command, - "log_id": log_id, - "state": "from_smsc hook error", - "error": str(e), - }, - ) - async def unbind(self) -> None: """ send an UNBIND pdu to SMSC. From aabea95ba6eb942b19df55b24b28e455104ce03b Mon Sep 17 00:00:00 2001 From: komuw Date: Thu, 28 Nov 2019 17:28:11 +0300 Subject: [PATCH 03/59] simple logger can log bytes --- naz/hooks.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/naz/hooks.py b/naz/hooks.py index c3229fbe..2d0f7652 100644 --- a/naz/hooks.py +++ b/naz/hooks.py @@ -80,7 +80,6 @@ async def to_smsc(self, smpp_command: str, log_id: str, hook_metadata: str, pdu: "smpp_command": smpp_command, "log_id": log_id, "hook_metadata": hook_metadata, - "pdu": pdu, }, ) @@ -101,6 +100,5 @@ async def from_smsc( "log_id": log_id, "hook_metadata": hook_metadata, "status": status.description, - "pdu": pdu, }, ) From 468cbd8186f73100a909d7f6c1667780a58888e3 Mon Sep 17 00:00:00 2001 From: komuw Date: Thu, 28 Nov 2019 17:28:57 +0300 Subject: [PATCH 04/59] simple logger can log bytes --- naz/hooks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/naz/hooks.py b/naz/hooks.py index 2d0f7652..57ed09dd 100644 --- a/naz/hooks.py +++ b/naz/hooks.py @@ -80,6 +80,7 @@ async def to_smsc(self, smpp_command: str, log_id: str, hook_metadata: str, pdu: "smpp_command": smpp_command, "log_id": log_id, "hook_metadata": hook_metadata, + # SimpleLogger cant log bytes(pdu) }, ) From 56754ca1819f76fd724d5e40337f560e9d622bfd Mon Sep 17 00:00:00 2001 From: Komu Wairagu Date: Fri, 29 Nov 2019 00:28:29 +0300 Subject: [PATCH 05/59] Update log.py --- naz/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/naz/log.py b/naz/log.py index 9ba3926a..712b3a3a 100644 --- a/naz/log.py +++ b/naz/log.py @@ -242,7 +242,7 @@ def __init__( maxlen=self.capacity # type: ignore ) # pytype: disable=attribute-error # assuming each log record is 250 bytes, then the maximum - # memory used by `buffer` will always be == 250*10_000/(1000*1000) == 2.5MB + # memory used by `buffer` will always be == 250*1_000/(1000*1000) == 0.25MB self.heartbeatInterval = heartbeatInterval if self.heartbeatInterval: From 626d2dcdb8f8b990521cc04790e48e1a93f6cf60 Mon Sep 17 00:00:00 2001 From: komuw Date: Fri, 29 Nov 2019 23:37:24 +0300 Subject: [PATCH 06/59] return a msg with a good error if decode fails --- naz/client.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/naz/client.py b/naz/client.py index 31d51edb..27fe40ba 100644 --- a/naz/client.py +++ b/naz/client.py @@ -723,15 +723,17 @@ def _msg_to_log(self, msg: bytes) -> str: returns decoded string from bytes with any password removed. the returned string is safe to log. """ + log_msg = "unable to decode msg" try: log_msg = self.codec_class.decode(msg) if self.password in log_msg: # do not log password, redact it from logs. log_msg = log_msg.replace(self.password, "{REDACTED}") - except (UnicodeDecodeError, UnicodeError): - log_msg = str(msg) - except Exception: - log_msg = "" + except (UnicodeDecodeError, UnicodeError) as e: + # in future we may want to do something custom + _ = e + except Exception as e: + _ = e return log_msg async def connect(self, log_id: str = "") -> None: From 34a84536a40f5c31e071b9ebae2277050f44cd52 Mon Sep 17 00:00:00 2001 From: Komu Wairagu Date: Tue, 3 Dec 2019 14:20:22 +0300 Subject: [PATCH 07/59] Update nazcodec.py --- naz/nazcodec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/naz/nazcodec.py b/naz/nazcodec.py index d1002457..51faf76c 100644 --- a/naz/nazcodec.py +++ b/naz/nazcodec.py @@ -245,6 +245,8 @@ class SimpleNazCodec(BaseNazCodec): ncodec.decode(b'Zo\xc3\xab') """ + custom_codecs = {"gsm0338": GSM7BitCodec(), "ucs2": UCS2Codec()} + def __init__(self, encoding: str = "gsm0338", errors_level: str = "strict") -> None: """ Parameters: @@ -264,8 +266,6 @@ def __init__(self, encoding: str = "gsm0338", errors_level: str = "strict") -> N self.encoding = encoding self.errors_level = errors_level - custom_codecs = {"gsm0338": GSM7BitCodec(), "ucs2": UCS2Codec()} - def encode(self, string_to_encode: str) -> bytes: if not isinstance(string_to_encode, str): raise NazCodecException("Only strings accepted for encoding.") From 6ce04f611e36fcc4f5ec9a11bf2bfb839a25fba4 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 16:18:10 +0300 Subject: [PATCH 08/59] repro --- examples/example_config.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/examples/example_config.py b/examples/example_config.py index 102ff972..1ca5b96f 100644 --- a/examples/example_config.py +++ b/examples/example_config.py @@ -10,11 +10,6 @@ system_id="smppclient1", password="password", broker=ExampleRedisBroker(), - sequence_generator=MySeqGen(), - logger=naz.log.SimpleLogger( - "naz.client", level="INFO", log_metadata={"environment": "staging", "release": "canary"} - ), - enquire_link_interval=70.00, - rateLimiter=MyRateLimiter(), - address_range="^254", # any msisdns beginning with 254. See Appendix A of SMPP spec doc + codec_class=naz.nazcodec.SimpleNazCodec(encoding="ucs2"), + socket_timeout=4.00, ) From 1587862612924be813f2af997015e71fa163e5f1 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 16:21:03 +0300 Subject: [PATCH 09/59] repro --- CHANGELOG.md | 4 ++++ naz/__version__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29f6aa01..721b2f74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ most recent version is listed first. +## **version:** v0.7.5 +- BugFix, `data_coding` should not be applied to all fields that are of type C-octet string: https://github.com/komuw/naz/pull/190 + + ## **version:** v0.7.4 - Fix a bug that prevented `enquire_link` and `deliver_sm` from been sent: https://github.com/komuw/naz/pull/179 - Enforce `naz` message protocol in code: https://github.com/komuw/naz/pull/179 diff --git a/naz/__version__.py b/naz/__version__.py index fe1d1bb7..93006c85 100644 --- a/naz/__version__.py +++ b/naz/__version__.py @@ -2,7 +2,7 @@ "__title__": "naz", "__description__": "Naz is an async SMPP client.", "__url__": "https://github.com/komuw/naz", - "__version__": "v0.7.4", + "__version__": "v0.7.5", "__author__": "komuW", "__author_email__": "komuw05@gmail.com", "__license__": "MIT", From 52a9c31e955c0ac9e705d36be1ec9cf5396174ab Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 16:43:58 +0300 Subject: [PATCH 10/59] add tests for different encoding --- naz/client.py | 3 ++- tests/test_client.py | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/naz/client.py b/naz/client.py index 27fe40ba..3483f87d 100644 --- a/naz/client.py +++ b/naz/client.py @@ -673,7 +673,8 @@ def _find_data_coding(encoding): if not key.startswith("__"): if encoding == val.code: return val.value - raise ValueError("That encoding:{0} is not recognised.".format(encoding)) + + raise ValueError("That encoding: `{0}` is not recognised.".format(encoding)) def _search_by_command_id_code(self, command_id_code: int) -> typing.Union[None, str]: for key, val in self.command_ids.items(): diff --git a/tests/test_client.py b/tests/test_client.py index 7d6d6a93..fb9bccc3 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1057,3 +1057,26 @@ def test_protocol_error(self): ) as mock_naz_unbind_and_disconnect: self._run(self.cli._parse_response_pdu(pdu=b"\x00\x00\x00\x15\x80")) self.assertTrue(mock_naz_unbind_and_disconnect.mock.called) + + def test_custom_encodings(self): + """ + tests that any of the encodings allowed by SMPP spec[1] can be used. + 1. https://github.com/komuw/naz/blob/c47f5030b720f3bac400dd6bd457b4415b0d5b7b/naz/state.py#L328 + 2. Also see section 5.2.19 of SMPP spec + """ + for encoding in ["gsm0338", "ucs2", "ascii", "latin_1", "iso2022jp", "iso8859_5"]: + cli = naz.Client( + smsc_host="127.0.0.1", + smsc_port=2775, + system_id="smppclient1", + password=os.getenv("password", "password"), + broker=self.broker, + logger=naz.log.SimpleLogger( + "TestClient", level="DEBUG", handler=naz.log.BreachHandler(capacity=200) + ), + socket_timeout=0.0000001, + codec_class=naz.nazcodec.SimpleNazCodec(encoding=encoding), + ) + self._run(cli.connect()) + self.assertTrue(hasattr(cli.reader, "read")) + self.assertTrue(hasattr(cli.writer, "write")) From bf0bd94a2d6d79f0a50c376483c292bbb5b06a60 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 16:46:20 +0300 Subject: [PATCH 11/59] init --- examples/example_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/example_config.py b/examples/example_config.py index 1ca5b96f..40686080 100644 --- a/examples/example_config.py +++ b/examples/example_config.py @@ -10,6 +10,6 @@ system_id="smppclient1", password="password", broker=ExampleRedisBroker(), - codec_class=naz.nazcodec.SimpleNazCodec(encoding="ucs2"), + codec_class=naz.nazcodec.SimpleNazCodec(encoding="iso8859_5"), socket_timeout=4.00, ) From 679e7c04156a92b6658ce783c1d69f254c67f56d Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 16:49:28 +0300 Subject: [PATCH 12/59] r --- examples/example_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/example_config.py b/examples/example_config.py index 40686080..1ca5b96f 100644 --- a/examples/example_config.py +++ b/examples/example_config.py @@ -10,6 +10,6 @@ system_id="smppclient1", password="password", broker=ExampleRedisBroker(), - codec_class=naz.nazcodec.SimpleNazCodec(encoding="iso8859_5"), + codec_class=naz.nazcodec.SimpleNazCodec(encoding="ucs2"), socket_timeout=4.00, ) From 1ed8d3cfce04f174418065b1fd5eac4afd1eab57 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 17:10:16 +0300 Subject: [PATCH 13/59] r --- docs/_sources/nazcodec.rst.txt | 2 +- documentation/sphinx-docs/nazcodec.rst | 2 +- naz/client.py | 12 +++--- naz/nazcodec.py | 58 +------------------------- naz/protocol.py | 19 ++++----- 5 files changed, 19 insertions(+), 74 deletions(-) diff --git a/docs/_sources/nazcodec.rst.txt b/docs/_sources/nazcodec.rst.txt index 63dd0cee..5408f6dd 100644 --- a/docs/_sources/nazcodec.rst.txt +++ b/docs/_sources/nazcodec.rst.txt @@ -2,6 +2,6 @@ nazcodec --------------- .. automodule:: naz.nazcodec - :members: BaseNazCodec, SimpleNazCodec + :members: SimpleNazCodec :show-inheritance: diff --git a/documentation/sphinx-docs/nazcodec.rst b/documentation/sphinx-docs/nazcodec.rst index 63dd0cee..5408f6dd 100644 --- a/documentation/sphinx-docs/nazcodec.rst +++ b/documentation/sphinx-docs/nazcodec.rst @@ -2,6 +2,6 @@ nazcodec --------------- .. automodule:: naz.nazcodec - :members: BaseNazCodec, SimpleNazCodec + :members: SimpleNazCodec :show-inheritance: diff --git a/naz/client.py b/naz/client.py index 3483f87d..514eef01 100644 --- a/naz/client.py +++ b/naz/client.py @@ -3,10 +3,12 @@ import random import socket import string +import codecs import typing import asyncio import logging + # pytype: disable=pyi-error from . import log from . import hooks @@ -103,7 +105,7 @@ def __init__( sm_default_msg_id: int = 0x00000000, enquire_link_interval: float = 55.00, logger: typing.Union[None, logging.Logger] = None, - codec_class: typing.Union[None, nazcodec.BaseNazCodec] = None, + codec_class: typing.Union[None, codecs.Codec] = None, rateLimiter: typing.Union[None, ratelimiter.BaseRateLimiter] = None, hook: typing.Union[None, hooks.BaseHook] = None, sequence_generator: typing.Union[None, sequence.BaseSequenceGenerator] = None, @@ -141,7 +143,7 @@ def __init__( messages to be sent to SMSC are queued using the said mechanism before been sent client_id: a unique string identifying a naz client class instance logger: python `logger `_ instance to be used for logging - codec_class: python class instance to be used to encode/decode messages + codec_class: python class instance, that is a child class of `codecs.Codec `_ to be used to encode/decode messages. enquire_link_interval: time in seconds to wait before sending an enquire_link request to SMSC to check on its status rateLimiter: python class instance implementing rate limitation hook: python class instance implemeting functionality/hooks to be called by naz \ @@ -375,7 +377,7 @@ def _validate_client_args( sm_default_msg_id: int, enquire_link_interval: float, logger: typing.Union[None, logging.Logger], - codec_class: typing.Union[None, nazcodec.BaseNazCodec], + codec_class: typing.Union[None, codecs.Codec], rateLimiter: typing.Union[None, ratelimiter.BaseRateLimiter], hook: typing.Union[None, hooks.BaseHook], sequence_generator: typing.Union[None, sequence.BaseSequenceGenerator], @@ -583,10 +585,10 @@ def _validate_client_args( ) ) ) - if not isinstance(codec_class, (type(None), nazcodec.BaseNazCodec)): + if not isinstance(codec_class, (type(None), codecs.Codec)): errors.append( ValueError( - "`codec_class` should be of type:: `None` or `naz.nazcodec.BaseNazCodec` You entered: {0}".format( + "`codec_class` should be of type:: `None` or `codecs.Codec` You entered: {0}".format( type(codec_class) ) ) diff --git a/naz/nazcodec.py b/naz/nazcodec.py index 51faf76c..e2cdb6b8 100644 --- a/naz/nazcodec.py +++ b/naz/nazcodec.py @@ -171,63 +171,7 @@ def decode(self, input, errors="strict"): return codecs.utf_16_be_decode(input, errors) # pytype: disable=module-attr -class BaseNazCodec(abc.ABC): - """ - This is the interface that must be implemented to satisfy naz's encoding/decoding. - User implementations should inherit this class and - implement the :func:`encode ` and :func:`decode ` methods with the type signatures shown. - - naz calls an implementation of this class to encode/decode messages. - """ - - def __init__(self, encoding: str = "gsm0338", errors_level: str = "strict") -> None: - """ - Parameters: - encoding: `encoding `_ used to encode messages been sent to SMSC - errors_level: same meaning as the errors argument to pythons' `encode `_ method - """ - if not isinstance(encoding, str): - raise ValueError( - "`encoding` should be of type:: `str` You entered: {0}".format(type(encoding)) - ) - if not isinstance(errors_level, str): - raise ValueError( - "`errors_level` should be of type:: `str` You entered: {0}".format( - type(errors_level) - ) - ) - self.encoding = encoding - self.errors_level = errors_level - - @abc.abstractmethod - def encode(self, string_to_encode: str) -> bytes: - """ - return an encoded version of the string as a bytes object - - Parameters: - string_to_encode: the string to encode - encoding: encoding scheme. eg utf-8, gsm0338 etc - errors: `same as defined in pythons codec.encode `_ - - Returns: - encoded version of input string - """ - raise NotImplementedError("encode method must be implemented.") - - @abc.abstractmethod - def decode(self, byte_string: bytes) -> str: - """ - return a string decoded from the given bytes. - - Parameters: - byte_string: the bytes to decode - encoding: encoding scheme. eg utf-8, gsm0338 etc - errors: `same as defined in pythons codec.decode `_ - """ - raise NotImplementedError("decode method must be implemented.") - - -class SimpleNazCodec(BaseNazCodec): +class SimpleNazCodec(codecs.Codec): """ This is an implementation of BaseNazCodec. diff --git a/naz/protocol.py b/naz/protocol.py index c7b3710f..dcf48f02 100644 --- a/naz/protocol.py +++ b/naz/protocol.py @@ -2,8 +2,7 @@ import json import typing - -from . import nazcodec +import codecs class Message: @@ -33,7 +32,7 @@ def __init__( smpp_command: str, log_id: str, pdu: typing.Union[None, bytes] = None, - codec_class: typing.Union[None, nazcodec.BaseNazCodec] = None, + codec_class: typing.Union[None, codecs.Codec] = None, short_message: typing.Union[None, str] = None, source_addr: typing.Union[None, str] = None, destination_addr: typing.Union[None, str] = None, @@ -45,7 +44,7 @@ def __init__( smpp_command: any one of the SMSC commands eg submit_sm log_id: a unique identify of this reque pdu: the full PDU as sent to SMSC. It is mutually exclusive with `short_message`. - codec_class: python class instance to be used to encode/decode messages. It should be a child class of `naz.nazcodec.BaseNazCodec`. + codec_class: python class instance to be used to encode/decode messages. It should be a child class of `codecs.Codec`. You should only specify this, if you also specified `pdu`, else you can leave it as None. short_message: message to send to SMSC. It is mutually exclusive with `pdu` source_addr: the identifier(eg msisdn) of the message sender. @@ -79,7 +78,7 @@ def _validate_protocol_args( smpp_command: str, log_id: str, pdu: typing.Union[None, bytes], - codec_class: typing.Union[None, nazcodec.BaseNazCodec], + codec_class: typing.Union[None, codecs.Codec], short_message: typing.Union[None, str], source_addr: typing.Union[None, str], destination_addr: typing.Union[None, str], @@ -129,9 +128,9 @@ def _validate_protocol_args( type(hook_metadata) ) ) - if not isinstance(codec_class, (type(None), nazcodec.BaseNazCodec)): + if not isinstance(codec_class, (type(None), codecs.Codec)): raise ValueError( - "`codec_class` should be of type:: `None` or `naz.nazcodec.BaseNazCodec` You entered: {0}".format( + "`codec_class` should be of type:: `None` or `codecs.Codec` You entered: {0}".format( type(codec_class) ) ) @@ -158,14 +157,14 @@ def to_json(self) -> str: if self.pdu: if typing.TYPE_CHECKING: # make mypy happy; https://github.com/python/mypy/issues/4805 - assert isinstance(self.codec_class, nazcodec.BaseNazCodec) + assert isinstance(self.codec_class, codecs.Codec) _item["pdu"] = self.codec_class.decode(self.pdu) return json.dumps(_item) @staticmethod def from_json( - json_message: str, codec_class: typing.Union[None, nazcodec.BaseNazCodec] = None + json_message: str, codec_class: typing.Union[None, codecs.Codec] = None ) -> Message: """ Deserializes the message protocol from json. You can use this method if you would @@ -173,7 +172,7 @@ def from_json( Parameters: json_message: `naz.protocol.Message` in json format. - codec_class: python class instance to be used to encode/decode messages. It should be a child class of `naz.nazcodec.BaseNazCodec`. + codec_class: python class instance to be used to encode/decode messages. It should be a child class of `codecs.Codec`. You should only specify this, if `json_message` has a key called `pdu` and it is not None. """ _in_dict = json.loads(json_message) From b1f3de7a2742df29463b971e343f8ac32b245f59 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 17:10:44 +0300 Subject: [PATCH 14/59] r --- naz/nazcodec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/naz/nazcodec.py b/naz/nazcodec.py index e2cdb6b8..0586d66e 100644 --- a/naz/nazcodec.py +++ b/naz/nazcodec.py @@ -173,7 +173,7 @@ def decode(self, input, errors="strict"): class SimpleNazCodec(codecs.Codec): """ - This is an implementation of BaseNazCodec. + This is an implementation of `codecs.Codec `_ SMPP uses a 7-bit GSM character set. This class implements that encoding/decoding scheme. This class can also be used with the usual `python standard encodings `_ From 8c84764776c341714ad5040029ed5cd55e04dc91 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 17:11:35 +0300 Subject: [PATCH 15/59] r --- docs/_sources/nazcodec.rst.txt | 2 +- docs/searchindex.js | 2 +- documentation/sphinx-docs/nazcodec.rst | 2 +- examples/example_config.py | 2 +- naz/client.py | 2 +- naz/nazcodec.py | 4 +-- tests/test_cli.py | 2 +- tests/test_client.py | 4 +-- tests/test_nazcodec.py | 38 +++++++++++++------------- tests/test_protocol.py | 4 +-- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/docs/_sources/nazcodec.rst.txt b/docs/_sources/nazcodec.rst.txt index 5408f6dd..b1173fae 100644 --- a/docs/_sources/nazcodec.rst.txt +++ b/docs/_sources/nazcodec.rst.txt @@ -2,6 +2,6 @@ nazcodec --------------- .. automodule:: naz.nazcodec - :members: SimpleNazCodec + :members: SimpleCodec :show-inheritance: diff --git a/docs/searchindex.js b/docs/searchindex.js index 724737e8..0b0d3c4c 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["broker","client","correlater","example_demo","hooks","index","introduction","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["broker.rst","client.rst","correlater.rst","example_demo.rst","hooks.rst","index.rst","introduction.rst","log.rst","nazcodec.rst","protocol.rst","ratelimiter.rst","sequence.rst","state.rst","throttle.rst"],objects:{"naz.broker":{BaseBroker:[0,1,1,""],SimpleBroker:[0,1,1,""]},"naz.broker.BaseBroker":{dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.broker.SimpleBroker":{__init__:[0,2,1,""],dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.client":{Client:[1,1,1,""],NazClientError:[1,3,1,""]},"naz.client.Client":{__init__:[1,2,1,""],command_handlers:[1,2,1,""],connect:[1,2,1,""],deliver_sm_resp:[1,2,1,""],dequeue_messages:[1,2,1,""],enquire_link:[1,2,1,""],enquire_link_resp:[1,2,1,""],re_establish_conn_bind:[1,2,1,""],receive_data:[1,2,1,""],send_data:[1,2,1,""],shutdown:[1,2,1,""],submit_sm:[1,2,1,""],tranceiver_bind:[1,2,1,""],unbind:[1,2,1,""],unbind_resp:[1,2,1,""]},"naz.correlater":{BaseCorrelater:[2,1,1,""],SimpleCorrelater:[2,1,1,""]},"naz.correlater.BaseCorrelater":{get:[2,2,1,""],put:[2,2,1,""]},"naz.correlater.SimpleCorrelater":{__init__:[2,2,1,""],get:[2,2,1,""],put:[2,2,1,""]},"naz.hooks":{BaseHook:[4,1,1,""],SimpleHook:[4,1,1,""]},"naz.hooks.BaseHook":{from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.hooks.SimpleHook":{__init__:[4,2,1,""],from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.log":{BreachHandler:[7,1,1,""],SimpleLogger:[7,1,1,""]},"naz.log.BreachHandler":{__init__:[7,2,1,""],emit:[7,2,1,""],shouldFlush:[7,2,1,""]},"naz.log.SimpleLogger":{__init__:[7,2,1,""],log:[7,2,1,""]},"naz.nazcodec":{BaseNazCodec:[8,1,1,""],SimpleNazCodec:[8,1,1,""]},"naz.nazcodec.BaseNazCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.nazcodec.SimpleNazCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.protocol":{Message:[9,1,1,""]},"naz.protocol.Message":{__init__:[9,2,1,""],from_json:[9,2,1,""],to_json:[9,2,1,""]},"naz.ratelimiter":{BaseRateLimiter:[10,1,1,""],SimpleRateLimiter:[10,1,1,""]},"naz.ratelimiter.BaseRateLimiter":{limit:[10,2,1,""]},"naz.ratelimiter.SimpleRateLimiter":{__init__:[10,2,1,""],limit:[10,2,1,""]},"naz.sequence":{BaseSequenceGenerator:[11,1,1,""],SimpleSequenceGenerator:[11,1,1,""]},"naz.sequence.BaseSequenceGenerator":{next_sequence:[11,2,1,""]},"naz.sequence.SimpleSequenceGenerator":{__init__:[11,2,1,""],next_sequence:[11,2,1,""]},"naz.state":{CommandStatus:[12,1,1,""],DataCoding:[12,1,1,""],SmppCommand:[12,1,1,""],SmppCommandStatus:[12,1,1,""],SmppDataCoding:[12,1,1,""],SmppOptionalTag:[12,1,1,""],SmppSessionState:[12,1,1,""]},"naz.state.CommandStatus":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.state.DataCoding":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.throttle":{BaseThrottleHandler:[13,1,1,""],SimpleThrottleHandler:[13,1,1,""]},"naz.throttle.BaseThrottleHandler":{allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},"naz.throttle.SimpleThrottleHandler":{__init__:[13,2,1,""],allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},naz:{broker:[0,0,0,"-"],client:[1,0,0,"-"],correlater:[2,0,0,"-"],hooks:[4,0,0,"-"],log:[7,0,0,"-"],nazcodec:[8,0,0,"-"],protocol:[9,0,0,"-"],ratelimiter:[10,0,0,"-"],sequence:[11,0,0,"-"],state:[12,0,0,"-"],throttle:[13,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception"},terms:{"0r5nd6bsd3g4atwux":3,"16be":8,"20min":6,"2billion":2,"7wjf935mqgsjplq7e":3,"\u03c3cmt":3,"\u30c4":6,"abstract":[0,2,4,8,10,11,13],"byte":[1,4,8,9],"class":[0,1,2,3,4,6,7,8,9,10,11,12,13],"default":[6,7],"final":6,"float":[1,2,7,10,13],"function":1,"h\u00fclk":[],"import":[1,3,6,7,9,10,13],"int":[0,1,2,7,9,11],"long":[3,6,13],"return":[0,1,2,3,4,6,7,8,9,10,11,13],"short":[1,6],"static":9,"super":6,"true":[3,7],"try":6,"while":[1,3],"zo\u00e3":8,"zo\u00eb":8,AND:13,AWS:3,And:[3,6],But:3,For:[3,6],One:2,REs:6,SMS:1,SQS:3,That:[1,6],The:[0,1,2,3,6,9,11,13],With:3,__init__:[0,1,2,3,4,6,7,8,9,10,11,13],_get_redi:3,_handler:7,_parse_response_pdu:1,_process_msg:6,_redi:3,abc:[0,2,4,8,10,11,13],abil:6,abl:[0,3,9],about:6,abov:[6,13],accept:3,acct:1,accur:[4,11],acknowledg:1,activ:[1,6],addhandl:[6,7],addit:1,addr_npi:1,addr_ton:1,address:[1,3],address_rang:1,after:[1,2,4,6,13],again:13,agnost:3,aha:7,aioredi:3,algorithm:[6,10],alia:12,all:[3,6,7],allow:[6,10,11],allow_request:13,alpin:3,also:[1,2,3,6,8,9,13],altern:7,among:2,ani:[1,2,3,4,6,9,13],annot:6,anoth:[2,3,6],anymor:13,anyth:6,api:6,app:[3,5],append:7,appli:7,applic:[1,2,3,4,6,9],arg:[6,7],argument:[3,7,8],around:[2,11],arrang:1,articl:7,artist:6,associ:1,async:[0,1,2,3,4,10,13],asynchron:1,asyncio:[1,3,6],attach:7,authent:1,auto:2,avail:3,await:[3,6,10],awesom:3,awesomestor:3,b526gdnxfbf8sqlzz:3,backward:6,band:6,base:[0,1,2,4,7,8,9,10,11,12,13],basebrok:[0,1,3,6],basecorrelat:[1,2],basehook:[1,4,6],basenazcodec:[1,8,9],baseratelimit:[1,6,10],basesequencegener:[1,11],basethrottlehandl:[1,6,13],basi:2,been:[1,3,7,8],befor:[1,3,4,6,7,13],benchmark:5,best:2,between:[1,2,6],bind:[1,6],bind_receiv:1,bind_transceiv:1,bind_transceiver_resp:1,bit:[7,8],block:1,bodi:1,body_data:1,bool:[1,7,13],both:3,breachhandl:7,bring:6,broker:[1,3,5,9],brpop:3,bucket:[6,10],buffer:[1,7],bug:5,busi:3,byte_str:8,calcul:13,call:[0,1,2,3,4,6,7,8,9,13],can:[0,1,3,6,7,8,9,10,12],capac:7,center:6,certain:7,chang:[3,6],charact:8,check:[1,6,7],child:9,choic:[3,6],cleanli:1,cli:[3,5],client:[3,6,9,10,13],client_id:[1,3,6],close:[6,7],cmt:1,code:[1,3,9,12],codec:8,codec_class:[1,9],com:7,come:2,command:[2,3,4,9,12],command_handl:[1,3],command_statu:3,command_status_valu:1,commandlin:6,commandstatu:[4,12],commit:6,commun:3,compos:6,condit:[7,13],config:6,confirm:3,conn:6,connect:[1,3,6],connection_lost:3,consult:[3,6],consum:6,contain:[3,6],content:6,continu:[1,6],control:[1,6,10],correl:[2,4,9,11],correlat:5,correlatinid:6,correlation_handl:1,could:7,counter:6,creat:[3,6],create_redis_pool:3,cthank:3,current:[3,6,9],cursor:6,custom:[3,6,10],damn:7,data:[1,4,6,12],databas:6,datacod:12,debug:[6,7],decid:[6,7,13],decis:13,declar:[1,6],decod:[1,3,8,9],def:[3,6],defin:8,delet:2,deliv:6,deliver_sm:[2,6],deliver_sm_resp:1,deliveri:[1,2,6],demo:[0,5,6],demo_naz:3,deni:[6,13],deny_request_at:[6,13],depend:6,dequed_item:3,dequeu:[0,1,3,6],dequeue_messag:[1,3,6],deriv:6,descript:[6,12],deseri:9,design:[1,6],dest_addr_npi:1,dest_addr_ton:1,destin:1,destination_addr:[1,3,6,9],determin:13,develop:[3,6],diagnost:7,dict:[1,7],dictionari:2,did:7,differ:[1,2,4,9],directori:[3,6],doc:6,docker:[3,6],document:3,doe:[1,6,7,10,13],domain:1,done:[2,3],dot:[3,6],drain_dur:1,dry:3,durat:[1,13],each:6,effort:2,elliot:7,els:[3,9],emit:7,emoji:6,empti:3,enabl:[9,13],encod:[1,8,9,12],end:3,enqueu:[0,1,3,6],enquire_link:[1,6],enquire_link_interv:1,enquire_link_resp:1,entiti:6,environ:6,error:[1,6,7,8],errors_level:8,esm:[1,6],esm_class:1,esme_rmsgq:13,esme_rthrottl:6,etc:[3,7,8,9],even:[6,7],event:[3,6,7],everi:7,everytim:13,everywher:5,evolv:9,exampl:[1,5,6,7,8,10],example_config:6,examplebrok:6,exc_info:7,exce:13,exceed:7,except:[1,6,7],exclus:9,execut:[3,6],exist:1,exit:3,expect:3,expir:2,extern:6,fals:[1,3,7,13],featur:[2,5],field:[1,12],file:[3,6,7],flag:1,flow:1,flush:7,flushlevel:7,flushonclos:7,forc:3,format:[3,6,9],formatt:[6,7],found:6,from:[1,2,3,4,6,7,8,9,13],from_json:[0,3,9],from_smsc:[4,6],full:[1,4,9,13],futur:9,gatewai:[1,6],gather:[1,6],gener:[1,6,11],get:[1,2,3,6,9,13],get_event_loop:[1,3,6],getenv:1,getlogg:7,give:[3,6],given:[2,7,8],goe:13,going:[2,3],good:[6,7],googl:7,got:[7,13],greater:[6,13],gsm0338:8,gsm:8,guarante:2,had:[2,3,4],hand:1,handl:[3,5,13],handler:[1,6,7,13],happen:6,happili:3,has:[0,6,9],hasn:7,have:[3,6,7,13],heartbeat:7,heartbeatinterv:7,hello:[6,9],help:[3,4,11],here:6,higher:7,hip:6,hold:6,hook:[1,3,5,9],hook_metadata1:2,hook_metadata2:2,hook_metadata:[1,2,4,6,9],hop:6,host:[1,3,6],houston:7,how:[3,6,13],howev:[2,3],http:[6,7],ident:1,identifi:[1,2,9],ignor:[],implement:[0,1,2,3,4,6,7,8,10,11,13],implemet:1,implemnet:3,impos:13,inc:6,includ:[3,7],incompat:6,increas:11,increment:6,indic:[1,9],info:[6,7],inform:[6,7],inherit:[0,2,4,8,10,11,13],init:6,initi:[4,11],inject:6,input:8,insid:3,inspir:7,instal:[3,5],instanc:[0,1,3,6,9],instantait:3,instanti:[1,3],integ:[7,11],integr:5,interact:1,interfac:[0,2,3,4,6,8,10,11,13],interface_vers:1,introduct:5,issu:6,item:[0,1,2,3,6],its:[1,3],itself:13,jayz:7,join:6,json:[0,7,9],json_messag:9,just:[1,4,6,13],kafka:3,keep:6,kei:[2,6,9],kenyan:6,keyword:7,klqk248jsk8:3,komuw:3,kvlog:6,kvlogger:6,kwarg:[6,7],last:13,later:[1,6,9],learn:3,least:7,leav:9,let:[3,6,10],level:[1,6,7],leverag:6,librari:5,like:[1,2,6,7,9],limit:[1,3,5,10,13],line:3,list:1,listen:[1,3],load:[6,13],localhost:3,log:[1,3,4,5,9],log_id1:2,log_id2:2,log_id:[1,2,3,4,6,9],log_metadata:[6,7],logger:[1,4,6,7,10,13],logger_nam:7,logic:3,look:[2,3,6],loop:[1,3,6],lost:1,lot:3,lpush:3,mai:[2,4,6,9,10,13],main:3,make:[1,3,6,13],mandat:2,manner:6,max_ttl:2,maximum:[0,7,10,11],maxsiz:[0,1,3,6],mean:8,mechan:[1,6],memori:[0,2,7],memoryhandl:7,messag:[0,1,2,3,4,6,7,8,9,10,13],met:7,metadata:[1,7],method:[0,1,2,4,6,8,9,10,11,13],metric:6,minimum:13,minsiz:3,minut:7,missi:7,mkdir:3,mode:1,monitor:5,monoton:11,more:[3,6,13],mostli:7,msg:[1,3,6,7,9],msisdn:[1,9],much:3,must:[0,2,4,8,10,11,13],mutual:9,my_app:6,my_brok:[3,6],my_client:3,my_config:6,my_naz_cli:[3,6],my_request:6,my_respons:6,myfil:6,myhook:6,myid12345:6,mylimit:6,mylogg:7,myprometheushook:6,myredisbrok:3,mysmsdb:6,mysteri:7,name:[1,6,7],naz:[0,1,2,4,7,8,9,10,11,12,13],naz_benchmarks_queu:3,nazclienterror:1,nazcodec:[5,9],nazizi:6,ncodec:8,neccesari:0,need:[3,6],network:1,new_msg:6,next:3,next_sequ:11,none:[0,1,2,3,4,7,8,9,10,11,13],not_throttl:13,note:[0,2],notif:[2,6],notset:[],now:3,npi:1,number:[0,1,2,6,7,12,13],object:[1,8,9,12],observ:5,occur:6,ofcours:6,off:3,okai:3,omit:2,onc:3,one:[2,3,4,9],onli:[0,3,6,7,9],option:[2,3,12],order:[0,3],origin:1,other:[2,3,6],ought:11,our:3,out:[1,3,6],outgo:6,over:[1,6,13],own:[3,6],paramet:[0,1,2,4,6,7,8,9,10,12,13],pars:1,parti:6,particular:[2,3,13],pass:[1,3,6,7,9],password:[1,3,6],path:[3,6],pdu:[1,4,6,9],per:[6,7],percent:13,percentag:[6,13],period:[1,6],pid:3,pip:[3,6],place:[3,6],plan:1,port:[1,3],possibl:3,postgr:9,predefin:1,previous:[2,4],print:6,prioriti:1,priority_flag:1,problem:7,process:7,prod:3,product:6,prometheu:6,prometheus_cli:6,properti:12,protocol:[0,1,3,5,6],protocol_id:1,purchas:3,purpos:[0,6],put:[0,2,7],put_nowait:6,python3:6,python:[1,2,3,6,7,8,9],python_path:3,queu:[1,6,9],queue:[0,1,3,6,13],queue_nam:3,rabbitmq:[3,6,9],rais:1,rang:[1,6,11],rate:[1,3,5,10,13],ratelimit:[1,5,6],re_establish_conn_bind:1,reach:11,read:[1,6],readi:3,real:3,reason:[2,6,13],rebind:1,receipt:1,receipted_message_id:2,receiv:[1,4,9],receive_data:[1,3,6],recipi:1,reconnect:1,record:[6,7],redi:[3,6,9],registered_deliveri:1,regul:13,relat:[1,2,3],releas:6,reliabl:2,render:[6,7],replac:[1,3],replace_if_present_flag:1,repli:[6,13],repo:6,represenst:12,represent:9,requ:9,request:[1,4,6,10,11,13],requir:[1,6],respect:1,respond:13,respons:[1,3,4,6,11,13],ring:7,round:6,rout:[1,6],run:[1,3,6],run_until_complet:[1,3,6],sai:6,said:1,same:8,sample_s:[6,13],sampling_period:[6,13],san:6,satisfi:[0,2,3,4,6,8,10,11,13],save:[0,9],schedul:1,schedule_delivery_tim:1,scheme:8,sdk:6,second:[1,2,6,7,10,13],see:[3,4,11],self:[3,4,6,11,13],send:[1,3,4,6,9,10,13],send_data:[1,3],send_messag:3,send_messsag:10,send_rat:[6,10],send_request:3,sender:[1,9],sens:6,sent:[1,3,4,8,9],sentri:6,sentry_sdk:6,sequenc:[1,2,5],sequence_gener:1,sequence_numb:[1,2,11],sequence_number1:2,serial:[0,9],serv:1,server:[1,3,6,10],servic:[1,6],service_typ:1,session:[1,12],set:[3,6,7,8],setformatt:[6,7],setlevel:[6,7],setmessagestatehook:6,setup:6,sever:7,ship:[3,6,9],shoe:3,shop:9,short_messag:[1,3,6,9],should:[0,1,2,3,4,6,7,8,9,10,11,13],shouldflush:7,show:[3,6],shown:[0,2,4,8,10,11,13],shutdown:1,signal:1,signatur:[0,2,4,8,10,11,13],signifi:1,simpl:[2,6],simplebrok:[0,1,6],simplecorrelat:2,simplehook:[4,6],simplelogg:[6,7],simplenazcodec:8,simpleratelimit:[6,10],simplesequencegener:11,simplethrottlehandl:[6,13],simul:[3,6],singl:1,size:0,sleep:3,sm_default_msg_id:1,sme:1,smpp:[1,2,3,6,8,11,12,13],smpp_command:[1,2,3,4,6,9],smpp_server:3,smppclient1:[1,3,6],smppcommand:[6,9,12],smppcommandstatu:12,smppdatacod:12,smppoptionaltag:12,smppsessionst:12,smsc:[1,2,3,4,6,8,9,10,13],smsc_host:[1,3,6],smsc_message_id1:2,smsc_message_id:2,smsc_port:[1,3,6],smstabl:6,socket:1,socket_timeout:1,softwar:3,some:[1,9],sometim:6,sourc:[0,1,2,4,7,8,9,10,11,12,13],source_addr:[1,3,6,9],source_addr_npi:1,source_addr_ton:1,specif:[1,11],specifi:[2,6,9,10],sql:6,sqlite3:6,stage:3,standard:8,standardconnectionhandl:3,start:[1,3,6,13],state:[1,3,4,5,6],statehook:6,statement:7,statu:[1,4,6,12,13],status:12,stderr:[],stdlib:7,stdout:7,stop:6,storag:2,store:[0,1,2,3,7],stored_at:2,str:[1,2,4,6,7,8,9],stream:7,streamhandl:[6,7],strict:8,string:[0,1,2,4,8,9],string_to_encod:8,structur:7,style:6,submit:[1,3],submit_sm:[1,2,3,4,6,9],submit_sm_resp:[2,3,4],success:3,suppli:[2,4,6],support:[1,6],suppos:6,surpass:6,system:1,system_id:[1,3,6],system_typ:1,tabl:6,tag:[2,12],take:[3,6],taken:7,talk:[3,6],target:7,targetlevel:7,task:[1,6],tell:7,termin:[1,6],test:[0,1,6],than:[6,13],thank:[3,9],thei:3,them:1,thi:[0,1,2,3,4,6,7,8,9,10,11,13],thing:3,third:6,those:6,throtll:[6,13],throttl:[1,3,5],throttle_delai:13,throttle_handl:[1,6],throttle_wait:13,throttler:6,through:3,thu:[6,13],time:[1,2,13],timeout:3,timestamp:3,tmp:[3,6],to_json:[0,3,9],to_smsc:[4,6],todo:1,token:[6,10],total:[6,13],track:[2,3,4],tracker:5,tracking_cod:3,tranceiver_bind:[1,6],transceiv:1,transfer:6,trigger:7,tupl:[2,12],tweet:7,two:6,type:[0,1,2,4,7,8,9,10,11,13],typic:3,ultim:[],unbind:[1,6],unbind_resp:1,under:[6,13],union:[1,2,7,9],uniqu:[1,2,7,9],updat:6,upto:6,url:7,usag:[3,5,7,8,9,10],use:[0,2,3,6,7,9],used:[0,1,3,6,7,8,9],user:[0,1,2,4,8,10,11,13],uses:[1,2,6,8],using:[1,2,5,6,10],usual:[6,8],utf8:[],utf:8,valid:1,validity_period:1,valu:[2,6,7,12],variou:[1,3,12],version:[1,3,6,8,9],via:[1,6,13],wai:[3,6,13],wait:[1,3,13],want:[2,3,4,6],watch:6,web_request:7,wether:13,what:[1,3,6,9],whatev:[6,13],when:[1,3,4,6,7,11,13],whenev:6,where:[3,6],wherea:3,whether:[1,3,7],which:[1,3,6,7,10,11,12,13],who:3,wikipedia:6,work:[6,13],world:6,would:[1,6,9],wrap:[2,11],write:[1,6],www:7,you:[0,1,3,6,7,9,10],your:[3,6,9],your_sentry_project_id:6,your_sentry_public_kei:6},titles:["broker","Client","correlater","Example demo of using naz","hooks","naz - naz is an async SMPP client.","Introduction to naz","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],titleterms:{api:5,app:6,async:[5,6],benchmark:6,broker:[0,6],bug:6,cli:6,client:[1,5],content:5,correlat:2,demo:3,everywher:6,exampl:3,featur:6,handl:6,hook:[4,6],instal:6,integr:6,introduct:6,librari:6,limit:6,log:[6,7],monitor:6,naz:[3,5,6],nazcodec:8,observ:6,protocol:9,rate:6,ratelimit:10,refer:5,sequenc:11,smpp:5,state:12,throttl:[6,13],tracker:6,usag:6,using:3}}) \ No newline at end of file +Search.setIndex({docnames:["broker","client","correlater","example_demo","hooks","index","introduction","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["broker.rst","client.rst","correlater.rst","example_demo.rst","hooks.rst","index.rst","introduction.rst","log.rst","nazcodec.rst","protocol.rst","ratelimiter.rst","sequence.rst","state.rst","throttle.rst"],objects:{"naz.broker":{BaseBroker:[0,1,1,""],SimpleBroker:[0,1,1,""]},"naz.broker.BaseBroker":{dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.broker.SimpleBroker":{__init__:[0,2,1,""],dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.client":{Client:[1,1,1,""],NazClientError:[1,3,1,""]},"naz.client.Client":{__init__:[1,2,1,""],command_handlers:[1,2,1,""],connect:[1,2,1,""],deliver_sm_resp:[1,2,1,""],dequeue_messages:[1,2,1,""],enquire_link:[1,2,1,""],enquire_link_resp:[1,2,1,""],re_establish_conn_bind:[1,2,1,""],receive_data:[1,2,1,""],send_data:[1,2,1,""],shutdown:[1,2,1,""],submit_sm:[1,2,1,""],tranceiver_bind:[1,2,1,""],unbind:[1,2,1,""],unbind_resp:[1,2,1,""]},"naz.correlater":{BaseCorrelater:[2,1,1,""],SimpleCorrelater:[2,1,1,""]},"naz.correlater.BaseCorrelater":{get:[2,2,1,""],put:[2,2,1,""]},"naz.correlater.SimpleCorrelater":{__init__:[2,2,1,""],get:[2,2,1,""],put:[2,2,1,""]},"naz.hooks":{BaseHook:[4,1,1,""],SimpleHook:[4,1,1,""]},"naz.hooks.BaseHook":{from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.hooks.SimpleHook":{__init__:[4,2,1,""],from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.log":{BreachHandler:[7,1,1,""],SimpleLogger:[7,1,1,""]},"naz.log.BreachHandler":{__init__:[7,2,1,""],emit:[7,2,1,""],shouldFlush:[7,2,1,""]},"naz.log.SimpleLogger":{__init__:[7,2,1,""],log:[7,2,1,""]},"naz.nazcodec":{BaseNazCodec:[8,1,1,""],SimpleCodec:[8,1,1,""]},"naz.nazcodec.BaseNazCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.nazcodec.SimpleCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.protocol":{Message:[9,1,1,""]},"naz.protocol.Message":{__init__:[9,2,1,""],from_json:[9,2,1,""],to_json:[9,2,1,""]},"naz.ratelimiter":{BaseRateLimiter:[10,1,1,""],SimpleRateLimiter:[10,1,1,""]},"naz.ratelimiter.BaseRateLimiter":{limit:[10,2,1,""]},"naz.ratelimiter.SimpleRateLimiter":{__init__:[10,2,1,""],limit:[10,2,1,""]},"naz.sequence":{BaseSequenceGenerator:[11,1,1,""],SimpleSequenceGenerator:[11,1,1,""]},"naz.sequence.BaseSequenceGenerator":{next_sequence:[11,2,1,""]},"naz.sequence.SimpleSequenceGenerator":{__init__:[11,2,1,""],next_sequence:[11,2,1,""]},"naz.state":{CommandStatus:[12,1,1,""],DataCoding:[12,1,1,""],SmppCommand:[12,1,1,""],SmppCommandStatus:[12,1,1,""],SmppDataCoding:[12,1,1,""],SmppOptionalTag:[12,1,1,""],SmppSessionState:[12,1,1,""]},"naz.state.CommandStatus":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.state.DataCoding":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.throttle":{BaseThrottleHandler:[13,1,1,""],SimpleThrottleHandler:[13,1,1,""]},"naz.throttle.BaseThrottleHandler":{allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},"naz.throttle.SimpleThrottleHandler":{__init__:[13,2,1,""],allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},naz:{broker:[0,0,0,"-"],client:[1,0,0,"-"],correlater:[2,0,0,"-"],hooks:[4,0,0,"-"],log:[7,0,0,"-"],nazcodec:[8,0,0,"-"],protocol:[9,0,0,"-"],ratelimiter:[10,0,0,"-"],sequence:[11,0,0,"-"],state:[12,0,0,"-"],throttle:[13,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception"},terms:{"0r5nd6bsd3g4atwux":3,"16be":8,"20min":6,"2billion":2,"7wjf935mqgsjplq7e":3,"\u03c3cmt":3,"\u30c4":6,"abstract":[0,2,4,8,10,11,13],"byte":[1,4,8,9],"class":[0,1,2,3,4,6,7,8,9,10,11,12,13],"default":[6,7],"final":6,"float":[1,2,7,10,13],"function":1,"h\u00fclk":[],"import":[1,3,6,7,9,10,13],"int":[0,1,2,7,9,11],"long":[3,6,13],"return":[0,1,2,3,4,6,7,8,9,10,11,13],"short":[1,6],"static":9,"super":6,"true":[3,7],"try":6,"while":[1,3],"zo\u00e3":8,"zo\u00eb":8,AND:13,AWS:3,And:[3,6],But:3,For:[3,6],One:2,REs:6,SMS:1,SQS:3,That:[1,6],The:[0,1,2,3,6,9,11,13],With:3,__init__:[0,1,2,3,4,6,7,8,9,10,11,13],_get_redi:3,_handler:7,_parse_response_pdu:1,_process_msg:6,_redi:3,abc:[0,2,4,8,10,11,13],abil:6,abl:[0,3,9],about:6,abov:[6,13],accept:3,acct:1,accur:[4,11],acknowledg:1,activ:[1,6],addhandl:[6,7],addit:1,addr_npi:1,addr_ton:1,address:[1,3],address_rang:1,after:[1,2,4,6,13],again:13,agnost:3,aha:7,aioredi:3,algorithm:[6,10],alia:12,all:[3,6,7],allow:[6,10,11],allow_request:13,alpin:3,also:[1,2,3,6,8,9,13],altern:7,among:2,ani:[1,2,3,4,6,9,13],annot:6,anoth:[2,3,6],anymor:13,anyth:6,api:6,app:[3,5],append:7,appli:7,applic:[1,2,3,4,6,9],arg:[6,7],argument:[3,7,8],around:[2,11],arrang:1,articl:7,artist:6,associ:1,async:[0,1,2,3,4,10,13],asynchron:1,asyncio:[1,3,6],attach:7,authent:1,auto:2,avail:3,await:[3,6,10],awesom:3,awesomestor:3,b526gdnxfbf8sqlzz:3,backward:6,band:6,base:[0,1,2,4,7,8,9,10,11,12,13],basebrok:[0,1,3,6],basecorrelat:[1,2],basehook:[1,4,6],basenazcodec:[1,8,9],baseratelimit:[1,6,10],basesequencegener:[1,11],basethrottlehandl:[1,6,13],basi:2,been:[1,3,7,8],befor:[1,3,4,6,7,13],benchmark:5,best:2,between:[1,2,6],bind:[1,6],bind_receiv:1,bind_transceiv:1,bind_transceiver_resp:1,bit:[7,8],block:1,bodi:1,body_data:1,bool:[1,7,13],both:3,breachhandl:7,bring:6,broker:[1,3,5,9],brpop:3,bucket:[6,10],buffer:[1,7],bug:5,busi:3,byte_str:8,calcul:13,call:[0,1,2,3,4,6,7,8,9,13],can:[0,1,3,6,7,8,9,10,12],capac:7,center:6,certain:7,chang:[3,6],charact:8,check:[1,6,7],child:9,choic:[3,6],cleanli:1,cli:[3,5],client:[3,6,9,10,13],client_id:[1,3,6],close:[6,7],cmt:1,code:[1,3,9,12],codec:8,codec_class:[1,9],com:7,come:2,command:[2,3,4,9,12],command_handl:[1,3],command_statu:3,command_status_valu:1,commandlin:6,commandstatu:[4,12],commit:6,commun:3,compos:6,condit:[7,13],config:6,confirm:3,conn:6,connect:[1,3,6],connection_lost:3,consult:[3,6],consum:6,contain:[3,6],content:6,continu:[1,6],control:[1,6,10],correl:[2,4,9,11],correlat:5,correlatinid:6,correlation_handl:1,could:7,counter:6,creat:[3,6],create_redis_pool:3,cthank:3,current:[3,6,9],cursor:6,custom:[3,6,10],damn:7,data:[1,4,6,12],databas:6,datacod:12,debug:[6,7],decid:[6,7,13],decis:13,declar:[1,6],decod:[1,3,8,9],def:[3,6],defin:8,delet:2,deliv:6,deliver_sm:[2,6],deliver_sm_resp:1,deliveri:[1,2,6],demo:[0,5,6],demo_naz:3,deni:[6,13],deny_request_at:[6,13],depend:6,dequed_item:3,dequeu:[0,1,3,6],dequeue_messag:[1,3,6],deriv:6,descript:[6,12],deseri:9,design:[1,6],dest_addr_npi:1,dest_addr_ton:1,destin:1,destination_addr:[1,3,6,9],determin:13,develop:[3,6],diagnost:7,dict:[1,7],dictionari:2,did:7,differ:[1,2,4,9],directori:[3,6],doc:6,docker:[3,6],document:3,doe:[1,6,7,10,13],domain:1,done:[2,3],dot:[3,6],drain_dur:1,dry:3,durat:[1,13],each:6,effort:2,elliot:7,els:[3,9],emit:7,emoji:6,empti:3,enabl:[9,13],encod:[1,8,9,12],end:3,enqueu:[0,1,3,6],enquire_link:[1,6],enquire_link_interv:1,enquire_link_resp:1,entiti:6,environ:6,error:[1,6,7,8],errors_level:8,esm:[1,6],esm_class:1,esme_rmsgq:13,esme_rthrottl:6,etc:[3,7,8,9],even:[6,7],event:[3,6,7],everi:7,everytim:13,everywher:5,evolv:9,exampl:[1,5,6,7,8,10],example_config:6,examplebrok:6,exc_info:7,exce:13,exceed:7,except:[1,6,7],exclus:9,execut:[3,6],exist:1,exit:3,expect:3,expir:2,extern:6,fals:[1,3,7,13],featur:[2,5],field:[1,12],file:[3,6,7],flag:1,flow:1,flush:7,flushlevel:7,flushonclos:7,forc:3,format:[3,6,9],formatt:[6,7],found:6,from:[1,2,3,4,6,7,8,9,13],from_json:[0,3,9],from_smsc:[4,6],full:[1,4,9,13],futur:9,gatewai:[1,6],gather:[1,6],gener:[1,6,11],get:[1,2,3,6,9,13],get_event_loop:[1,3,6],getenv:1,getlogg:7,give:[3,6],given:[2,7,8],goe:13,going:[2,3],good:[6,7],googl:7,got:[7,13],greater:[6,13],gsm0338:8,gsm:8,guarante:2,had:[2,3,4],hand:1,handl:[3,5,13],handler:[1,6,7,13],happen:6,happili:3,has:[0,6,9],hasn:7,have:[3,6,7,13],heartbeat:7,heartbeatinterv:7,hello:[6,9],help:[3,4,11],here:6,higher:7,hip:6,hold:6,hook:[1,3,5,9],hook_metadata1:2,hook_metadata2:2,hook_metadata:[1,2,4,6,9],hop:6,host:[1,3,6],houston:7,how:[3,6,13],howev:[2,3],http:[6,7],ident:1,identifi:[1,2,9],ignor:[],implement:[0,1,2,3,4,6,7,8,10,11,13],implemet:1,implemnet:3,impos:13,inc:6,includ:[3,7],incompat:6,increas:11,increment:6,indic:[1,9],info:[6,7],inform:[6,7],inherit:[0,2,4,8,10,11,13],init:6,initi:[4,11],inject:6,input:8,insid:3,inspir:7,instal:[3,5],instanc:[0,1,3,6,9],instantait:3,instanti:[1,3],integ:[7,11],integr:5,interact:1,interfac:[0,2,3,4,6,8,10,11,13],interface_vers:1,introduct:5,issu:6,item:[0,1,2,3,6],its:[1,3],itself:13,jayz:7,join:6,json:[0,7,9],json_messag:9,just:[1,4,6,13],kafka:3,keep:6,kei:[2,6,9],kenyan:6,keyword:7,klqk248jsk8:3,komuw:3,kvlog:6,kvlogger:6,kwarg:[6,7],last:13,later:[1,6,9],learn:3,least:7,leav:9,let:[3,6,10],level:[1,6,7],leverag:6,librari:5,like:[1,2,6,7,9],limit:[1,3,5,10,13],line:3,list:1,listen:[1,3],load:[6,13],localhost:3,log:[1,3,4,5,9],log_id1:2,log_id2:2,log_id:[1,2,3,4,6,9],log_metadata:[6,7],logger:[1,4,6,7,10,13],logger_nam:7,logic:3,look:[2,3,6],loop:[1,3,6],lost:1,lot:3,lpush:3,mai:[2,4,6,9,10,13],main:3,make:[1,3,6,13],mandat:2,manner:6,max_ttl:2,maximum:[0,7,10,11],maxsiz:[0,1,3,6],mean:8,mechan:[1,6],memori:[0,2,7],memoryhandl:7,messag:[0,1,2,3,4,6,7,8,9,10,13],met:7,metadata:[1,7],method:[0,1,2,4,6,8,9,10,11,13],metric:6,minimum:13,minsiz:3,minut:7,missi:7,mkdir:3,mode:1,monitor:5,monoton:11,more:[3,6,13],mostli:7,msg:[1,3,6,7,9],msisdn:[1,9],much:3,must:[0,2,4,8,10,11,13],mutual:9,my_app:6,my_brok:[3,6],my_client:3,my_config:6,my_naz_cli:[3,6],my_request:6,my_respons:6,myfil:6,myhook:6,myid12345:6,mylimit:6,mylogg:7,myprometheushook:6,myredisbrok:3,mysmsdb:6,mysteri:7,name:[1,6,7],naz:[0,1,2,4,7,8,9,10,11,12,13],naz_benchmarks_queu:3,nazclienterror:1,nazcodec:[5,9],nazizi:6,ncodec:8,neccesari:0,need:[3,6],network:1,new_msg:6,next:3,next_sequ:11,none:[0,1,2,3,4,7,8,9,10,11,13],not_throttl:13,note:[0,2],notif:[2,6],notset:[],now:3,npi:1,number:[0,1,2,6,7,12,13],object:[1,8,9,12],observ:5,occur:6,ofcours:6,off:3,okai:3,omit:2,onc:3,one:[2,3,4,9],onli:[0,3,6,7,9],option:[2,3,12],order:[0,3],origin:1,other:[2,3,6],ought:11,our:3,out:[1,3,6],outgo:6,over:[1,6,13],own:[3,6],paramet:[0,1,2,4,6,7,8,9,10,12,13],pars:1,parti:6,particular:[2,3,13],pass:[1,3,6,7,9],password:[1,3,6],path:[3,6],pdu:[1,4,6,9],per:[6,7],percent:13,percentag:[6,13],period:[1,6],pid:3,pip:[3,6],place:[3,6],plan:1,port:[1,3],possibl:3,postgr:9,predefin:1,previous:[2,4],print:6,prioriti:1,priority_flag:1,problem:7,process:7,prod:3,product:6,prometheu:6,prometheus_cli:6,properti:12,protocol:[0,1,3,5,6],protocol_id:1,purchas:3,purpos:[0,6],put:[0,2,7],put_nowait:6,python3:6,python:[1,2,3,6,7,8,9],python_path:3,queu:[1,6,9],queue:[0,1,3,6,13],queue_nam:3,rabbitmq:[3,6,9],rais:1,rang:[1,6,11],rate:[1,3,5,10,13],ratelimit:[1,5,6],re_establish_conn_bind:1,reach:11,read:[1,6],readi:3,real:3,reason:[2,6,13],rebind:1,receipt:1,receipted_message_id:2,receiv:[1,4,9],receive_data:[1,3,6],recipi:1,reconnect:1,record:[6,7],redi:[3,6,9],registered_deliveri:1,regul:13,relat:[1,2,3],releas:6,reliabl:2,render:[6,7],replac:[1,3],replace_if_present_flag:1,repli:[6,13],repo:6,represenst:12,represent:9,requ:9,request:[1,4,6,10,11,13],requir:[1,6],respect:1,respond:13,respons:[1,3,4,6,11,13],ring:7,round:6,rout:[1,6],run:[1,3,6],run_until_complet:[1,3,6],sai:6,said:1,same:8,sample_s:[6,13],sampling_period:[6,13],san:6,satisfi:[0,2,3,4,6,8,10,11,13],save:[0,9],schedul:1,schedule_delivery_tim:1,scheme:8,sdk:6,second:[1,2,6,7,10,13],see:[3,4,11],self:[3,4,6,11,13],send:[1,3,4,6,9,10,13],send_data:[1,3],send_messag:3,send_messsag:10,send_rat:[6,10],send_request:3,sender:[1,9],sens:6,sent:[1,3,4,8,9],sentri:6,sentry_sdk:6,sequenc:[1,2,5],sequence_gener:1,sequence_numb:[1,2,11],sequence_number1:2,serial:[0,9],serv:1,server:[1,3,6,10],servic:[1,6],service_typ:1,session:[1,12],set:[3,6,7,8],setformatt:[6,7],setlevel:[6,7],setmessagestatehook:6,setup:6,sever:7,ship:[3,6,9],shoe:3,shop:9,short_messag:[1,3,6,9],should:[0,1,2,3,4,6,7,8,9,10,11,13],shouldflush:7,show:[3,6],shown:[0,2,4,8,10,11,13],shutdown:1,signal:1,signatur:[0,2,4,8,10,11,13],signifi:1,simpl:[2,6],simplebrok:[0,1,6],simplecorrelat:2,simplehook:[4,6],simplelogg:[6,7],SimpleCodec:8,simpleratelimit:[6,10],simplesequencegener:11,simplethrottlehandl:[6,13],simul:[3,6],singl:1,size:0,sleep:3,sm_default_msg_id:1,sme:1,smpp:[1,2,3,6,8,11,12,13],smpp_command:[1,2,3,4,6,9],smpp_server:3,smppclient1:[1,3,6],smppcommand:[6,9,12],smppcommandstatu:12,smppdatacod:12,smppoptionaltag:12,smppsessionst:12,smsc:[1,2,3,4,6,8,9,10,13],smsc_host:[1,3,6],smsc_message_id1:2,smsc_message_id:2,smsc_port:[1,3,6],smstabl:6,socket:1,socket_timeout:1,softwar:3,some:[1,9],sometim:6,sourc:[0,1,2,4,7,8,9,10,11,12,13],source_addr:[1,3,6,9],source_addr_npi:1,source_addr_ton:1,specif:[1,11],specifi:[2,6,9,10],sql:6,sqlite3:6,stage:3,standard:8,standardconnectionhandl:3,start:[1,3,6,13],state:[1,3,4,5,6],statehook:6,statement:7,statu:[1,4,6,12,13],status:12,stderr:[],stdlib:7,stdout:7,stop:6,storag:2,store:[0,1,2,3,7],stored_at:2,str:[1,2,4,6,7,8,9],stream:7,streamhandl:[6,7],strict:8,string:[0,1,2,4,8,9],string_to_encod:8,structur:7,style:6,submit:[1,3],submit_sm:[1,2,3,4,6,9],submit_sm_resp:[2,3,4],success:3,suppli:[2,4,6],support:[1,6],suppos:6,surpass:6,system:1,system_id:[1,3,6],system_typ:1,tabl:6,tag:[2,12],take:[3,6],taken:7,talk:[3,6],target:7,targetlevel:7,task:[1,6],tell:7,termin:[1,6],test:[0,1,6],than:[6,13],thank:[3,9],thei:3,them:1,thi:[0,1,2,3,4,6,7,8,9,10,11,13],thing:3,third:6,those:6,throtll:[6,13],throttl:[1,3,5],throttle_delai:13,throttle_handl:[1,6],throttle_wait:13,throttler:6,through:3,thu:[6,13],time:[1,2,13],timeout:3,timestamp:3,tmp:[3,6],to_json:[0,3,9],to_smsc:[4,6],todo:1,token:[6,10],total:[6,13],track:[2,3,4],tracker:5,tracking_cod:3,tranceiver_bind:[1,6],transceiv:1,transfer:6,trigger:7,tupl:[2,12],tweet:7,two:6,type:[0,1,2,4,7,8,9,10,11,13],typic:3,ultim:[],unbind:[1,6],unbind_resp:1,under:[6,13],union:[1,2,7,9],uniqu:[1,2,7,9],updat:6,upto:6,url:7,usag:[3,5,7,8,9,10],use:[0,2,3,6,7,9],used:[0,1,3,6,7,8,9],user:[0,1,2,4,8,10,11,13],uses:[1,2,6,8],using:[1,2,5,6,10],usual:[6,8],utf8:[],utf:8,valid:1,validity_period:1,valu:[2,6,7,12],variou:[1,3,12],version:[1,3,6,8,9],via:[1,6,13],wai:[3,6,13],wait:[1,3,13],want:[2,3,4,6],watch:6,web_request:7,wether:13,what:[1,3,6,9],whatev:[6,13],when:[1,3,4,6,7,11,13],whenev:6,where:[3,6],wherea:3,whether:[1,3,7],which:[1,3,6,7,10,11,12,13],who:3,wikipedia:6,work:[6,13],world:6,would:[1,6,9],wrap:[2,11],write:[1,6],www:7,you:[0,1,3,6,7,9,10],your:[3,6,9],your_sentry_project_id:6,your_sentry_public_kei:6},titles:["broker","Client","correlater","Example demo of using naz","hooks","naz - naz is an async SMPP client.","Introduction to naz","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],titleterms:{api:5,app:6,async:[5,6],benchmark:6,broker:[0,6],bug:6,cli:6,client:[1,5],content:5,correlat:2,demo:3,everywher:6,exampl:3,featur:6,handl:6,hook:[4,6],instal:6,integr:6,introduct:6,librari:6,limit:6,log:[6,7],monitor:6,naz:[3,5,6],nazcodec:8,observ:6,protocol:9,rate:6,ratelimit:10,refer:5,sequenc:11,smpp:5,state:12,throttl:[6,13],tracker:6,usag:6,using:3}}) \ No newline at end of file diff --git a/documentation/sphinx-docs/nazcodec.rst b/documentation/sphinx-docs/nazcodec.rst index 5408f6dd..b1173fae 100644 --- a/documentation/sphinx-docs/nazcodec.rst +++ b/documentation/sphinx-docs/nazcodec.rst @@ -2,6 +2,6 @@ nazcodec --------------- .. automodule:: naz.nazcodec - :members: SimpleNazCodec + :members: SimpleCodec :show-inheritance: diff --git a/examples/example_config.py b/examples/example_config.py index 1ca5b96f..87cc66eb 100644 --- a/examples/example_config.py +++ b/examples/example_config.py @@ -10,6 +10,6 @@ system_id="smppclient1", password="password", broker=ExampleRedisBroker(), - codec_class=naz.nazcodec.SimpleNazCodec(encoding="ucs2"), + codec_class=naz.nazcodec.SimpleCodec(encoding="ucs2"), socket_timeout=4.00, ) diff --git a/naz/client.py b/naz/client.py index 514eef01..53055ac8 100644 --- a/naz/client.py +++ b/naz/client.py @@ -236,7 +236,7 @@ def __init__( if codec_class is not None: self.codec_class = codec_class else: - self.codec_class = nazcodec.SimpleNazCodec() + self.codec_class = nazcodec.SimpleCodec() self.service_type = service_type self.source_addr_ton = source_addr_ton diff --git a/naz/nazcodec.py b/naz/nazcodec.py index 0586d66e..309f51d9 100644 --- a/naz/nazcodec.py +++ b/naz/nazcodec.py @@ -171,7 +171,7 @@ def decode(self, input, errors="strict"): return codecs.utf_16_be_decode(input, errors) # pytype: disable=module-attr -class SimpleNazCodec(codecs.Codec): +class SimpleCodec(codecs.Codec): """ This is an implementation of `codecs.Codec `_ @@ -183,7 +183,7 @@ class SimpleNazCodec(codecs.Codec): .. highlight:: python .. code-block:: python - ncodec = SimpleNazCodec(encoding="utf-16be") + ncodec = SimpleCodec(encoding="utf-16be") ncodec.encode("Zoë") ncodec.decode(b'Zo\xc3\xab') diff --git a/tests/test_cli.py b/tests/test_cli.py index 8194fa8a..3bb02cb2 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -47,7 +47,7 @@ def parse_args(self, args=None, namespace=None): ), enquire_link_interval=30.00, rateLimiter=MyRateLimiter(), - codec_class=naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="ignore"), + codec_class=naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="ignore"), ) BAD_NAZ_CLIENT = MySeqGen() diff --git a/tests/test_client.py b/tests/test_client.py index fb9bccc3..98164bee 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -236,7 +236,7 @@ def mock_create_client(): system_id="smppclient1", password=os.getenv("password", "password"), broker=self.broker, - codec_class=naz.nazcodec.SimpleNazCodec(encoding=encoding), + codec_class=naz.nazcodec.SimpleCodec(encoding=encoding), ) self.assertRaises(ValueError, mock_create_client) @@ -1075,7 +1075,7 @@ def test_custom_encodings(self): "TestClient", level="DEBUG", handler=naz.log.BreachHandler(capacity=200) ), socket_timeout=0.0000001, - codec_class=naz.nazcodec.SimpleNazCodec(encoding=encoding), + codec_class=naz.nazcodec.SimpleCodec(encoding=encoding), ) self._run(cli.connect()) self.assertTrue(hasattr(cli.reader, "read")) diff --git a/tests/test_nazcodec.py b/tests/test_nazcodec.py index 06481122..54514878 100644 --- a/tests/test_nazcodec.py +++ b/tests/test_nazcodec.py @@ -44,85 +44,85 @@ class TestNazCodec(TestCase): """ def test_byte_encode_guard(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="utf-8", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertRaises(naz.nazcodec.NazCodecException, codec.encode, b"some bytes") def test_string_decode_guard(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="utf-8", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertRaises(naz.nazcodec.NazCodecException, codec.decode, "unicode") def test_default_encoding(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="utf-8", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertEqual(codec.encode("a"), b"a") def test_default_decoding(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="utf-8", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertEqual(codec.decode(b"a"), "a") def test_encode_utf8(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="utf-8", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertEqual(codec.encode("Zoë"), b"Zo\xc3\xab") def test_decode_utf8(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="utf-8", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertEqual(codec.decode(b"Zo\xc3\xab"), "Zoë") def test_encode_utf16be(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="utf-16be", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="utf-16be", errors_level="strict") self.assertEqual(codec.encode("Zoë"), b"\x00Z\x00o\x00\xeb") def test_decode_utf16be(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="utf-16be", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="utf-16be", errors_level="strict") self.assertEqual(codec.decode(b"\x00Z\x00o\x00\xeb"), "Zoë") def test_encode_ucs2(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="ucs2", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="ucs2", errors_level="strict") self.assertEqual(codec.encode("Zoë"), b"\x00Z\x00o\x00\xeb") def test_decode_ucs2(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="ucs2", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="ucs2", errors_level="strict") self.assertEqual(codec.decode(b"\x00Z\x00o\x00\xeb"), "Zoë") def test_encode_gsm0338(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertEqual( codec.encode("HÜLK"), "".join([chr(code) for code in [72, 94, 76, 75]]).encode() ) def test_encode_gsm0338_extended(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertEqual( codec.encode("foo €"), "".join([chr(code) for code in [102, 111, 111, 32, 27, 101]]).encode(), ) def test_decode_gsm0338_extended(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertEqual( codec.decode("".join([chr(code) for code in [102, 111, 111, 32, 27, 101]]).encode()), "foo €", ) def test_encode_gsm0338_strict(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertRaises(UnicodeEncodeError, codec.encode, "Zoë") def test_encode_gsm0338_ignore(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="ignore") + codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="ignore") self.assertEqual(codec.encode("Zoë"), b"Zo") def test_encode_gsm0338_replace(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="replace") + codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="replace") self.assertEqual(codec.encode("Zoë"), b"Zo?") def test_decode_gsm0338_strict(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="strict") + codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertRaises(UnicodeDecodeError, codec.decode, "Zoë".encode("utf-8")) def test_decode_gsm0338_ignore(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="ignore") + codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="ignore") self.assertEqual(codec.decode("Zoë".encode("utf-8")), "Zo") def test_decode_gsm0338_replace(self): - codec = naz.nazcodec.SimpleNazCodec(encoding="gsm0338", errors_level="replace") + codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="replace") self.assertEqual(codec.decode("Zoë".encode("utf-8")), "Zo??") diff --git a/tests/test_protocol.py b/tests/test_protocol.py index 5bfe9f1a..9f71b208 100644 --- a/tests/test_protocol.py +++ b/tests/test_protocol.py @@ -46,7 +46,7 @@ def test_json_serialization(self): smpp_command=naz.SmppCommand.BIND_TRANSCEIVER_RESP, log_id="some-log-id", pdu=b"pdu", - codec_class=naz.nazcodec.SimpleNazCodec(encoding="utf-8"), + codec_class=naz.nazcodec.SimpleCodec(encoding="utf-8"), ) _in_json = proto.to_json() _in_dict = json.loads(_in_json) @@ -75,7 +75,7 @@ def test_json_de_serialization(self): } _in_json = json.dumps(x) proto = naz.protocol.Message.from_json( - _in_json, codec_class=naz.nazcodec.SimpleNazCodec(encoding="utf-8") + _in_json, codec_class=naz.nazcodec.SimpleCodec(encoding="utf-8") ) self.assertIsInstance(proto, naz.protocol.Message) From 726852f6c60b13935e36180d725b220dd786bc6c Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 17:23:15 +0300 Subject: [PATCH 16/59] r --- naz/nazcodec.py | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/naz/nazcodec.py b/naz/nazcodec.py index 309f51d9..624f0f93 100644 --- a/naz/nazcodec.py +++ b/naz/nazcodec.py @@ -183,7 +183,7 @@ class SimpleCodec(codecs.Codec): .. highlight:: python .. code-block:: python - ncodec = SimpleCodec(encoding="utf-16be") + ncodec = SimpleCodec(encoding="ucs2") ncodec.encode("Zoë") ncodec.decode(b'Zo\xc3\xab') @@ -191,43 +191,36 @@ class SimpleCodec(codecs.Codec): custom_codecs = {"gsm0338": GSM7BitCodec(), "ucs2": UCS2Codec()} - def __init__(self, encoding: str = "gsm0338", errors_level: str = "strict") -> None: + def __init__(self, encoding: str = "gsm0338") -> None: """ Parameters: - encoding: `encoding `_ used to encode messages been sent to SMSC - errors_level: same meaning as the errors argument to pythons' `encode `_ method + encoding: `encoding `_ used to encode messages been sent to SMSC + The encoding should be one of the encodings recognised by the SMPP specification. See section 5.2.19 of SMPP spec """ if not isinstance(encoding, str): raise ValueError( "`encoding` should be of type:: `str` You entered: {0}".format(type(encoding)) ) - if not isinstance(errors_level, str): - raise ValueError( - "`errors_level` should be of type:: `str` You entered: {0}".format( - type(errors_level) - ) - ) self.encoding = encoding - self.errors_level = errors_level - def encode(self, string_to_encode: str) -> bytes: - if not isinstance(string_to_encode, str): + def encode(self, input: str, errors: str = "strict") -> typing.Tuple[bytes, int]: + if not isinstance(input, str): raise NazCodecException("Only strings accepted for encoding.") encoding = self.encoding or sys.getdefaultencoding() if encoding in self.custom_codecs: encoder = self.custom_codecs[encoding].encode else: encoder = codecs.getencoder(encoding) - obj, _ = encoder(string_to_encode, self.errors_level) - return obj - def decode(self, byte_string: bytes) -> str: - if not isinstance(byte_string, (bytes, bytearray)): + return encoder(input, errors) + + def decode(self, input: bytes, errors: str = "strict") -> typing.Tuple[str, int]: + if not isinstance(input, (bytes, bytearray)): raise NazCodecException("Only bytestrings accepted for decoding.") encoding = self.encoding or sys.getdefaultencoding() if encoding in self.custom_codecs: decoder = self.custom_codecs[encoding].decode else: decoder = codecs.getdecoder(encoding) - obj, _ = decoder(byte_string, self.errors_level) - return obj + + return decoder(input, errors) From 19e0d3dfbe96bb0da1677461a788bc3e0bcbd350 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 17:24:45 +0300 Subject: [PATCH 17/59] r --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 721b2f74..2dcfcc7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ most recent version is listed first. ## **version:** v0.7.5 -- BugFix, `data_coding` should not be applied to all fields that are of type C-octet string: https://github.com/komuw/naz/pull/190 +- BugFix, `data_coding` should not be applied to all fields that are of type C-octet string: https://github.com/komuw/naz/pull/190 +- Make `naz.Client.codec_class` accept any child class implementation of python's `codecs.Codec`: https://github.com/komuw/naz/pull/190 ## **version:** v0.7.4 From 8023d33c5e4cfe5a8759b44b4c23e292033cf590 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 17:28:47 +0300 Subject: [PATCH 18/59] r --- naz/client.py | 2 +- naz/nazcodec.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/naz/client.py b/naz/client.py index 53055ac8..12897d51 100644 --- a/naz/client.py +++ b/naz/client.py @@ -143,7 +143,7 @@ def __init__( messages to be sent to SMSC are queued using the said mechanism before been sent client_id: a unique string identifying a naz client class instance logger: python `logger `_ instance to be used for logging - codec_class: python class instance, that is a child class of `codecs.Codec `_ to be used to encode/decode messages. + codec_class: python class instance, that is a child class of `codecs.Codec `_ to be used to encode/decode messages. enquire_link_interval: time in seconds to wait before sending an enquire_link request to SMSC to check on its status rateLimiter: python class instance implementing rate limitation hook: python class instance implemeting functionality/hooks to be called by naz \ diff --git a/naz/nazcodec.py b/naz/nazcodec.py index 624f0f93..5f442995 100644 --- a/naz/nazcodec.py +++ b/naz/nazcodec.py @@ -31,9 +31,10 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -import abc + import sys import codecs +import typing # An alternative to using this codec module is to use: https://github.com/dsch/gsm0338 From 1084c8b2c2c717d9856d54d8ce2b4f780649fb79 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 17:31:00 +0300 Subject: [PATCH 19/59] repro --- docs/_modules/index.html | 4 +- docs/_modules/naz/broker.html | 4 +- docs/_modules/naz/client.html | 80 +++++++------- docs/_modules/naz/correlater.html | 4 +- docs/_modules/naz/hooks.html | 7 +- docs/_modules/naz/log.html | 6 +- docs/_modules/naz/nazcodec.html | 104 ++++------------- docs/_modules/naz/protocol.html | 23 ++-- docs/_modules/naz/ratelimiter.html | 4 +- docs/_modules/naz/sequence.html | 4 +- docs/_modules/naz/state.html | 4 +- docs/_modules/naz/throttle.html | 4 +- docs/_static/documentation_options.js | 2 +- docs/broker.html | 4 +- docs/client.html | 6 +- docs/correlater.html | 4 +- docs/example_demo.html | 4 +- docs/genindex.html | 34 ++---- docs/hooks.html | 4 +- docs/index.html | 4 +- docs/introduction.html | 4 +- docs/log.html | 4 +- docs/nazcodec.html | 153 +++++++------------------- docs/objects.inv | Bin 1171 -> 1151 bytes docs/protocol.html | 8 +- docs/py-modindex.html | 4 +- docs/ratelimiter.html | 4 +- docs/search.html | 4 +- docs/searchindex.js | 2 +- docs/sequence.html | 4 +- docs/state.html | 4 +- docs/throttle.html | 4 +- 32 files changed, 182 insertions(+), 323 deletions(-) diff --git a/docs/_modules/index.html b/docs/_modules/index.html index 1cdcffa0..6bb35a06 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -8,7 +8,7 @@ - Overview: module code — naz v0.7.4 documentation + Overview: module code — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
diff --git a/docs/_modules/naz/broker.html b/docs/_modules/naz/broker.html index 40fe02d4..4a519f9d 100644 --- a/docs/_modules/naz/broker.html +++ b/docs/_modules/naz/broker.html @@ -8,7 +8,7 @@ - naz.broker — naz v0.7.4 documentation + naz.broker — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
diff --git a/docs/_modules/naz/client.html b/docs/_modules/naz/client.html index c35d11d0..f00f6a16 100644 --- a/docs/_modules/naz/client.html +++ b/docs/_modules/naz/client.html @@ -8,7 +8,7 @@ - naz.client — naz v0.7.4 documentation + naz.client — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
@@ -168,10 +168,12 @@

Source code for naz.client

 import random
 import socket
 import string
+import codecs
 import typing
 import asyncio
 import logging
 
+
 # pytype: disable=pyi-error
 from . import log
 from . import hooks
@@ -268,7 +270,7 @@ 

Source code for naz.client

         sm_default_msg_id: int = 0x00000000,
         enquire_link_interval: float = 55.00,
         logger: typing.Union[None, logging.Logger] = None,
-        codec_class: typing.Union[None, nazcodec.BaseNazCodec] = None,
+        codec_class: typing.Union[None, codecs.Codec] = None,
         rateLimiter: typing.Union[None, ratelimiter.BaseRateLimiter] = None,
         hook: typing.Union[None, hooks.BaseHook] = None,
         sequence_generator: typing.Union[None, sequence.BaseSequenceGenerator] = None,
@@ -306,7 +308,7 @@ 

Source code for naz.client

                 messages to be sent to SMSC are queued using the said mechanism before been sent
             client_id:	a unique string identifying a naz client class instance
             logger: python `logger <https://docs.python.org/3/library/logging.html#logging.Logger>`_ instance to be used for logging
-            codec_class: python class instance to be used to encode/decode messages
+            codec_class: python class instance, that is a child class of `codecs.Codec <https://docs.python.org/3/library/codecs.html>`_ to be used to encode/decode messages.
             enquire_link_interval:	time in seconds to wait before sending an enquire_link request to SMSC to check on its status
             rateLimiter: python class instance implementing rate limitation
             hook: python class instance implemeting functionality/hooks to be called by naz \
@@ -399,7 +401,7 @@ 

Source code for naz.client

         if codec_class is not None:
             self.codec_class = codec_class
         else:
-            self.codec_class = nazcodec.SimpleNazCodec()
+            self.codec_class = nazcodec.SimpleCodec()
 
         self.service_type = service_type
         self.source_addr_ton = source_addr_ton
@@ -540,7 +542,7 @@ 

Source code for naz.client

         sm_default_msg_id: int,
         enquire_link_interval: float,
         logger: typing.Union[None, logging.Logger],
-        codec_class: typing.Union[None, nazcodec.BaseNazCodec],
+        codec_class: typing.Union[None, codecs.Codec],
         rateLimiter: typing.Union[None, ratelimiter.BaseRateLimiter],
         hook: typing.Union[None, hooks.BaseHook],
         sequence_generator: typing.Union[None, sequence.BaseSequenceGenerator],
@@ -748,10 +750,10 @@ 

Source code for naz.client

                     )
                 )
             )
-        if not isinstance(codec_class, (type(None), nazcodec.BaseNazCodec)):
+        if not isinstance(codec_class, (type(None), codecs.Codec)):
             errors.append(
                 ValueError(
-                    "`codec_class` should be of type:: `None` or `naz.nazcodec.BaseNazCodec` You entered: {0}".format(
+                    "`codec_class` should be of type:: `None` or `codecs.Codec` You entered: {0}".format(
                         type(codec_class)
                     )
                 )
@@ -838,7 +840,8 @@ 

Source code for naz.client

             if not key.startswith("__"):
                 if encoding == val.code:
                     return val.value
-        raise ValueError("That encoding:{0} is not recognised.".format(encoding))
+
+        raise ValueError("That encoding: `{0}` is not recognised.".format(encoding))
 
     def _search_by_command_id_code(self, command_id_code: int) -> typing.Union[None, str]:
         for key, val in self.command_ids.items():
@@ -888,15 +891,17 @@ 

Source code for naz.client

         returns decoded string from bytes with any password removed.
         the returned string is safe to log.
         """
+        log_msg = "unable to decode msg"
         try:
             log_msg = self.codec_class.decode(msg)
             if self.password in log_msg:
                 # do not log password, redact it from logs.
                 log_msg = log_msg.replace(self.password, "{REDACTED}")
-        except (UnicodeDecodeError, UnicodeError):
-            log_msg = str(msg)
-        except Exception:
-            log_msg = ""
+        except (UnicodeDecodeError, UnicodeError) as e:
+            # in future we may want to do something custom
+            _ = e
+        except Exception as e:
+            _ = e
         return log_msg
 
 
[docs] async def connect(self, log_id: str = "") -> None: @@ -2271,13 +2276,13 @@

Source code for naz.client

 
         try:
             # call throttling handler
-            if commandStatus.value == SmppCommandStatus.ESME_ROK.value:
-                await self.throttle_handler.not_throttled()
-            elif commandStatus.value in [
+            if commandStatus.value in [
                 SmppCommandStatus.ESME_RTHROTTLED.value,
                 SmppCommandStatus.ESME_RMSGQFUL.value,
             ]:
                 await self.throttle_handler.throttled()
+            else:
+                await self.throttle_handler.not_throttled()
         except Exception as e:
             self._log(
                 logging.ERROR,
@@ -2290,6 +2295,27 @@ 

Source code for naz.client

                     "state": commandStatus.description,
                 },
             )
+        try:
+            # call user's hook for responses
+            await self.hook.from_smsc(
+                smpp_command=smpp_command,
+                log_id=log_id,
+                hook_metadata=hook_metadata,
+                status=commandStatus,
+                pdu=pdu,
+            )
+        except Exception as e:
+            self._log(
+                logging.ERROR,
+                {
+                    "event": "naz.Client.command_handlers",
+                    "stage": "end",
+                    "smpp_command": smpp_command,
+                    "log_id": log_id,
+                    "state": "from_smsc hook error",
+                    "error": str(e),
+                },
+            )
 
         if smpp_command in [
             SmppCommand.BIND_TRANSCEIVER,
@@ -2426,28 +2452,6 @@ 

Source code for naz.client

                         smpp_command
                     ),
                 },
-            )
-
-        # call user's hook for responses
-        try:
-            await self.hook.from_smsc(
-                smpp_command=smpp_command,
-                log_id=log_id,
-                hook_metadata=hook_metadata,
-                status=commandStatus,
-                pdu=pdu,
-            )
-        except Exception as e:
-            self._log(
-                logging.ERROR,
-                {
-                    "event": "naz.Client.command_handlers",
-                    "stage": "end",
-                    "smpp_command": smpp_command,
-                    "log_id": log_id,
-                    "state": "from_smsc hook error",
-                    "error": str(e),
-                },
             )
[docs] async def unbind(self) -> None: diff --git a/docs/_modules/naz/correlater.html b/docs/_modules/naz/correlater.html index 68c287a8..817ae714 100644 --- a/docs/_modules/naz/correlater.html +++ b/docs/_modules/naz/correlater.html @@ -8,7 +8,7 @@ - naz.correlater — naz v0.7.4 documentation + naz.correlater — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
diff --git a/docs/_modules/naz/hooks.html b/docs/_modules/naz/hooks.html index b9dd1f3e..1078fb88 100644 --- a/docs/_modules/naz/hooks.html +++ b/docs/_modules/naz/hooks.html @@ -8,7 +8,7 @@ - naz.hooks — naz v0.7.4 documentation + naz.hooks — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
@@ -245,7 +245,7 @@

Source code for naz.hooks

                 "smpp_command": smpp_command,
                 "log_id": log_id,
                 "hook_metadata": hook_metadata,
-                "pdu": pdu,
+                # SimpleLogger cant log bytes(pdu)
             },
         )
@@ -266,7 +266,6 @@

Source code for naz.hooks

                 "log_id": log_id,
                 "hook_metadata": hook_metadata,
                 "status": status.description,
-                "pdu": pdu,
             },
         )
diff --git a/docs/_modules/naz/log.html b/docs/_modules/naz/log.html index efe6167f..e7612a0c 100644 --- a/docs/_modules/naz/log.html +++ b/docs/_modules/naz/log.html @@ -8,7 +8,7 @@ - naz.log — naz v0.7.4 documentation + naz.log — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
@@ -407,7 +407,7 @@

Source code for naz.log

             maxlen=self.capacity  # type: ignore
         )  # pytype: disable=attribute-error
         # assuming each log record is 250 bytes, then the maximum
-        # memory used by `buffer` will always be == 250*10_000/(1000*1000) == 2.5MB
+        # memory used by `buffer` will always be == 250*1_000/(1000*1000) == 0.25MB
 
         self.heartbeatInterval = heartbeatInterval
         if self.heartbeatInterval:
diff --git a/docs/_modules/naz/nazcodec.html b/docs/_modules/naz/nazcodec.html
index 4347688a..9c051e57 100644
--- a/docs/_modules/naz/nazcodec.html
+++ b/docs/_modules/naz/nazcodec.html
@@ -8,7 +8,7 @@
   
   
   
-  naz.nazcodec — naz v0.7.4 documentation
+  naz.nazcodec — naz v0.7.5 documentation
   
 
   
@@ -60,7 +60,7 @@
             
             
               
- v0.7.4 + v0.7.5
@@ -196,9 +196,10 @@

Source code for naz.nazcodec

 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-import abc
+
 import sys
 import codecs
+import typing
 
 
 # An alternative to using this codec module is to use: https://github.com/dsch/gsm0338
@@ -336,65 +337,9 @@ 

Source code for naz.nazcodec

         return codecs.utf_16_be_decode(input, errors)  # pytype: disable=module-attr
 
 
-
[docs]class BaseNazCodec(abc.ABC): - """ - This is the interface that must be implemented to satisfy naz's encoding/decoding. - User implementations should inherit this class and - implement the :func:`encode <BaseNazCodec.encode>` and :func:`decode <BaseNazCodec.decode>` methods with the type signatures shown. - - naz calls an implementation of this class to encode/decode messages. - """ - -
[docs] def __init__(self, encoding: str = "gsm0338", errors_level: str = "strict") -> None: - """ - Parameters: - encoding: `encoding <https://docs.python.org/3/library/codecs.html#standard-encodings>`_ used to encode messages been sent to SMSC - errors_level: same meaning as the errors argument to pythons' `encode <https://docs.python.org/3/library/codecs.html#codecs.encode>`_ method - """ - if not isinstance(encoding, str): - raise ValueError( - "`encoding` should be of type:: `str` You entered: {0}".format(type(encoding)) - ) - if not isinstance(errors_level, str): - raise ValueError( - "`errors_level` should be of type:: `str` You entered: {0}".format( - type(errors_level) - ) - ) - self.encoding = encoding - self.errors_level = errors_level
- -
[docs] @abc.abstractmethod - def encode(self, string_to_encode: str) -> bytes: - """ - return an encoded version of the string as a bytes object - - Parameters: - string_to_encode: the string to encode - encoding: encoding scheme. eg utf-8, gsm0338 etc - errors: `same as defined in pythons codec.encode <https://docs.python.org/3/library/codecs.html#codecs.encode>`_ - - Returns: - encoded version of input string - """ - raise NotImplementedError("encode method must be implemented.")
- -
[docs] @abc.abstractmethod - def decode(self, byte_string: bytes) -> str: - """ - return a string decoded from the given bytes. - - Parameters: - byte_string: the bytes to decode - encoding: encoding scheme. eg utf-8, gsm0338 etc - errors: `same as defined in pythons codec.decode <https://docs.python.org/3/library/codecs.html#codecs.decode>`_ - """ - raise NotImplementedError("decode method must be implemented.")
- - -
[docs]class SimpleNazCodec(BaseNazCodec): +
[docs]class SimpleCodec(codecs.Codec): """ - This is an implementation of BaseNazCodec. + This is an implementation of `codecs.Codec <https://docs.python.org/3/library/codecs.html>`_ SMPP uses a 7-bit GSM character set. This class implements that encoding/decoding scheme. This class can also be used with the usual `python standard encodings <https://docs.python.org/3/library/codecs.html#standard-encodings>`_ @@ -404,54 +349,47 @@

Source code for naz.nazcodec

     .. highlight:: python
     .. code-block:: python
 
-       ncodec = SimpleNazCodec(encoding="utf-16be")
+       ncodec = SimpleCodec(encoding="ucs2")
 
        ncodec.encode("Zoë")
        ncodec.decode(b'Zo\xc3\xab')
     """
 
-
[docs] def __init__(self, encoding: str = "gsm0338", errors_level: str = "strict") -> None: + custom_codecs = {"gsm0338": GSM7BitCodec(), "ucs2": UCS2Codec()} + +
[docs] def __init__(self, encoding: str = "gsm0338") -> None: """ Parameters: - encoding: `encoding <https://docs.python.org/3/library/codecs.html#standard-encodings>`_ used to encode messages been sent to SMSC - errors_level: same meaning as the errors argument to pythons' `encode <https://docs.python.org/3/library/codecs.html#codecs.encode>`_ method + encoding: `encoding <https://docs.python.org/3/library/codecs.html#standard-encodings>`_ used to encode messages been sent to SMSC + The encoding should be one of the encodings recognised by the SMPP specification. See section 5.2.19 of SMPP spec """ if not isinstance(encoding, str): raise ValueError( "`encoding` should be of type:: `str` You entered: {0}".format(type(encoding)) ) - if not isinstance(errors_level, str): - raise ValueError( - "`errors_level` should be of type:: `str` You entered: {0}".format( - type(errors_level) - ) - ) - self.encoding = encoding - self.errors_level = errors_level
+ self.encoding = encoding
- custom_codecs = {"gsm0338": GSM7BitCodec(), "ucs2": UCS2Codec()} - -
[docs] def encode(self, string_to_encode: str) -> bytes: - if not isinstance(string_to_encode, str): +
[docs] def encode(self, input: str, errors: str = "strict") -> typing.Tuple[bytes, int]: + if not isinstance(input, str): raise NazCodecException("Only strings accepted for encoding.") encoding = self.encoding or sys.getdefaultencoding() if encoding in self.custom_codecs: encoder = self.custom_codecs[encoding].encode else: encoder = codecs.getencoder(encoding) - obj, _ = encoder(string_to_encode, self.errors_level) - return obj
-
[docs] def decode(self, byte_string: bytes) -> str: - if not isinstance(byte_string, (bytes, bytearray)): + return encoder(input, errors)
+ +
[docs] def decode(self, input: bytes, errors: str = "strict") -> typing.Tuple[str, int]: + if not isinstance(input, (bytes, bytearray)): raise NazCodecException("Only bytestrings accepted for decoding.") encoding = self.encoding or sys.getdefaultencoding() if encoding in self.custom_codecs: decoder = self.custom_codecs[encoding].decode else: decoder = codecs.getdecoder(encoding) - obj, _ = decoder(byte_string, self.errors_level) - return obj
+ + return decoder(input, errors)
diff --git a/docs/_modules/naz/protocol.html b/docs/_modules/naz/protocol.html index 4e91e973..57a5f6ed 100644 --- a/docs/_modules/naz/protocol.html +++ b/docs/_modules/naz/protocol.html @@ -8,7 +8,7 @@ - naz.protocol — naz v0.7.4 documentation + naz.protocol — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
@@ -167,8 +167,7 @@

Source code for naz.protocol

 
 import json
 import typing
-
-from . import nazcodec
+import codecs
 
 
 
[docs]class Message: @@ -198,7 +197,7 @@

Source code for naz.protocol

         smpp_command: str,
         log_id: str,
         pdu: typing.Union[None, bytes] = None,
-        codec_class: typing.Union[None, nazcodec.BaseNazCodec] = None,
+        codec_class: typing.Union[None, codecs.Codec] = None,
         short_message: typing.Union[None, str] = None,
         source_addr: typing.Union[None, str] = None,
         destination_addr: typing.Union[None, str] = None,
@@ -210,7 +209,7 @@ 

Source code for naz.protocol

             smpp_command: any one of the SMSC commands eg submit_sm
             log_id: a unique identify of this reque
             pdu: the full PDU as sent to SMSC. It is mutually exclusive with `short_message`.
-            codec_class: python class instance to be used to encode/decode messages. It should be a child class of `naz.nazcodec.BaseNazCodec`.
+            codec_class: python class instance to be used to encode/decode messages. It should be a child class of `codecs.Codec`.
                          You should only specify this, if you also specified `pdu`, else you can leave it as None.
             short_message: message to send to SMSC. It is mutually exclusive with `pdu`
             source_addr: the identifier(eg msisdn) of the message sender.
@@ -244,7 +243,7 @@ 

Source code for naz.protocol

         smpp_command: str,
         log_id: str,
         pdu: typing.Union[None, bytes],
-        codec_class: typing.Union[None, nazcodec.BaseNazCodec],
+        codec_class: typing.Union[None, codecs.Codec],
         short_message: typing.Union[None, str],
         source_addr: typing.Union[None, str],
         destination_addr: typing.Union[None, str],
@@ -294,9 +293,9 @@ 

Source code for naz.protocol

                     type(hook_metadata)
                 )
             )
-        if not isinstance(codec_class, (type(None), nazcodec.BaseNazCodec)):
+        if not isinstance(codec_class, (type(None), codecs.Codec)):
             raise ValueError(
-                "`codec_class` should be of type:: `None` or `naz.nazcodec.BaseNazCodec` You entered: {0}".format(
+                "`codec_class` should be of type:: `None` or `codecs.Codec` You entered: {0}".format(
                     type(codec_class)
                 )
             )
@@ -323,14 +322,14 @@ 

Source code for naz.protocol

         if self.pdu:
             if typing.TYPE_CHECKING:
                 # make mypy happy; https://github.com/python/mypy/issues/4805
-                assert isinstance(self.codec_class, nazcodec.BaseNazCodec)
+                assert isinstance(self.codec_class, codecs.Codec)
             _item["pdu"] = self.codec_class.decode(self.pdu)
 
         return json.dumps(_item)
[docs] @staticmethod def from_json( - json_message: str, codec_class: typing.Union[None, nazcodec.BaseNazCodec] = None + json_message: str, codec_class: typing.Union[None, codecs.Codec] = None ) -> Message: """ Deserializes the message protocol from json. You can use this method if you would @@ -338,7 +337,7 @@

Source code for naz.protocol

 
         Parameters:
             json_message: `naz.protocol.Message` in json format.
-            codec_class: python class instance to be used to encode/decode messages. It should be a child class of `naz.nazcodec.BaseNazCodec`.
+            codec_class: python class instance to be used to encode/decode messages. It should be a child class of `codecs.Codec`.
                          You should only specify this, if `json_message` has a key called `pdu` and it is not None.
         """
         _in_dict = json.loads(json_message)
diff --git a/docs/_modules/naz/ratelimiter.html b/docs/_modules/naz/ratelimiter.html
index b315778a..e14ea57b 100644
--- a/docs/_modules/naz/ratelimiter.html
+++ b/docs/_modules/naz/ratelimiter.html
@@ -8,7 +8,7 @@
   
   
   
-  naz.ratelimiter — naz v0.7.4 documentation
+  naz.ratelimiter — naz v0.7.5 documentation
   
 
   
@@ -60,7 +60,7 @@
             
             
               
- v0.7.4 + v0.7.5
diff --git a/docs/_modules/naz/sequence.html b/docs/_modules/naz/sequence.html index db903b09..65e46da0 100644 --- a/docs/_modules/naz/sequence.html +++ b/docs/_modules/naz/sequence.html @@ -8,7 +8,7 @@ - naz.sequence — naz v0.7.4 documentation + naz.sequence — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
diff --git a/docs/_modules/naz/state.html b/docs/_modules/naz/state.html index 224d8ec5..15aa3522 100644 --- a/docs/_modules/naz/state.html +++ b/docs/_modules/naz/state.html @@ -8,7 +8,7 @@ - naz.state — naz v0.7.4 documentation + naz.state — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
diff --git a/docs/_modules/naz/throttle.html b/docs/_modules/naz/throttle.html index c655fa32..21b61a12 100644 --- a/docs/_modules/naz/throttle.html +++ b/docs/_modules/naz/throttle.html @@ -8,7 +8,7 @@ - naz.throttle — naz v0.7.4 documentation + naz.throttle — naz v0.7.5 documentation @@ -60,7 +60,7 @@
- v0.7.4 + v0.7.5
diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 71d2c1ca..f8478c76 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: 'v0.7.4', + VERSION: 'v0.7.5', LANGUAGE: 'None', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', diff --git a/docs/broker.html b/docs/broker.html index 71170654..f710d44d 100644 --- a/docs/broker.html +++ b/docs/broker.html @@ -8,7 +8,7 @@ - broker — naz v0.7.4 documentation + broker — naz v0.7.5 documentation @@ -62,7 +62,7 @@
- v0.7.4 + v0.7.5
diff --git a/docs/client.html b/docs/client.html index 0fc00830..4f4a9116 100644 --- a/docs/client.html +++ b/docs/client.html @@ -8,7 +8,7 @@ - Client — naz v0.7.4 documentation + Client — naz v0.7.5 documentation @@ -62,7 +62,7 @@
- v0.7.4 + v0.7.5
@@ -235,7 +235,7 @@
  • broker (BaseBroker) – python class instance implementing some queueing mechanism. messages to be sent to SMSC are queued using the said mechanism before been sent

  • client_id (Union[None, str]) – a unique string identifying a naz client class instance

  • logger (Union[None, Logger]) – python logger instance to be used for logging

  • -
  • codec_class (Union[None, BaseNazCodec]) – python class instance to be used to encode/decode messages

  • +
  • codec_class (Union[None, Codec]) – python class instance, that is a child class of codecs.Codec to be used to encode/decode messages.

  • enquire_link_interval (float) – time in seconds to wait before sending an enquire_link request to SMSC to check on its status

  • rateLimiter (Union[None, BaseRateLimiter]) – python class instance implementing rate limitation

  • hook (Union[None, BaseHook]) – python class instance implemeting functionality/hooks to be called by naz just before sending request to SMSC and just after getting response from SMSC

  • diff --git a/docs/correlater.html b/docs/correlater.html index a5ea26f2..bcf3fabc 100644 --- a/docs/correlater.html +++ b/docs/correlater.html @@ -8,7 +8,7 @@ - correlater — naz v0.7.4 documentation + correlater — naz v0.7.5 documentation @@ -62,7 +62,7 @@
    - v0.7.4 + v0.7.5
    diff --git a/docs/example_demo.html b/docs/example_demo.html index 8f7cc042..03e7dff0 100644 --- a/docs/example_demo.html +++ b/docs/example_demo.html @@ -8,7 +8,7 @@ - Example demo of using naz — naz v0.7.4 documentation + Example demo of using naz — naz v0.7.5 documentation @@ -62,7 +62,7 @@
    - v0.7.4 + v0.7.5
    diff --git a/docs/genindex.html b/docs/genindex.html index b092d71d..7d5ef737 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -9,7 +9,7 @@ - Index — naz v0.7.4 documentation + Index — naz v0.7.5 documentation @@ -61,7 +61,7 @@
    - v0.7.4 + v0.7.5
    @@ -202,9 +202,7 @@

    _

  • (naz.log.SimpleLogger method)
  • -
  • (naz.nazcodec.BaseNazCodec method) -
  • -
  • (naz.nazcodec.SimpleNazCodec method) +
  • (naz.nazcodec.SimpleCodec method)
  • (naz.protocol.Message method)
  • @@ -238,8 +236,6 @@

    B

  • BaseCorrelater (class in naz.correlater)
  • BaseHook (class in naz.hooks) -
  • -
  • BaseNazCodec (class in naz.nazcodec)
    • @@ -281,22 +277,18 @@

      D

      - +
      • dequeue_messages() (naz.client.Client method)
      • description() (naz.state.CommandStatus property) @@ -313,20 +305,16 @@

        E

        - +
          diff --git a/docs/hooks.html b/docs/hooks.html index 5244e177..e6909a8e 100644 --- a/docs/hooks.html +++ b/docs/hooks.html @@ -8,7 +8,7 @@ - hooks — naz v0.7.4 documentation + hooks — naz v0.7.5 documentation @@ -62,7 +62,7 @@
          - v0.7.4 + v0.7.5
          diff --git a/docs/index.html b/docs/index.html index d86efdd0..a42c973a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -8,7 +8,7 @@ - naz - naz is an async SMPP client. — naz v0.7.4 documentation + naz - naz is an async SMPP client. — naz v0.7.5 documentation @@ -61,7 +61,7 @@
          - v0.7.4 + v0.7.5
          diff --git a/docs/introduction.html b/docs/introduction.html index 75f0939f..35c5a3e5 100644 --- a/docs/introduction.html +++ b/docs/introduction.html @@ -8,7 +8,7 @@ - Introduction to naz — naz v0.7.4 documentation + Introduction to naz — naz v0.7.5 documentation @@ -62,7 +62,7 @@
          - v0.7.4 + v0.7.5
          diff --git a/docs/log.html b/docs/log.html index df0117ca..408e6304 100644 --- a/docs/log.html +++ b/docs/log.html @@ -8,7 +8,7 @@ - log — naz v0.7.4 documentation + log — naz v0.7.5 documentation @@ -61,7 +61,7 @@
          - v0.7.4 + v0.7.5
          diff --git a/docs/nazcodec.html b/docs/nazcodec.html index fc21cd1e..86e7f04e 100644 --- a/docs/nazcodec.html +++ b/docs/nazcodec.html @@ -8,7 +8,7 @@ - nazcodec — naz v0.7.4 documentation + nazcodec — naz v0.7.5 documentation @@ -62,7 +62,7 @@
          - v0.7.4 + v0.7.5
          @@ -169,97 +169,26 @@

          nazcodec

          -
          -class naz.nazcodec.BaseNazCodec(encoding='gsm0338', errors_level='strict')[source]
          -

          Bases: abc.ABC

          -

          This is the interface that must be implemented to satisfy naz’s encoding/decoding. -User implementations should inherit this class and -implement the encode and decode methods with the type signatures shown.

          -

          naz calls an implementation of this class to encode/decode messages.

          -
          -
          -__init__(encoding='gsm0338', errors_level='strict')[source]
          -
          -
          Parameters
          -
            -
          • encoding (str) – encoding used to encode messages been sent to SMSC

          • -
          • errors_level (str) – same meaning as the errors argument to pythons’ encode method

          • -
          -
          -
          Return type
          -

          None

          -
          -
          -
          - -
          -
          -abstract decode(byte_string)[source]
          -
          -

          return a string decoded from the given bytes.

          -
          -
          -
          Parameters
          -
          -
          -
          Return type
          -

          str

          -
          -
          -
          - -
          -
          -abstract encode(string_to_encode)[source]
          -

          return an encoded version of the string as a bytes object

          -
          -
          Parameters
          -
          -
          -
          Return type
          -

          bytes

          -
          -
          Returns
          -

          encoded version of input string

          -
          -
          -
          - -
          - -
          -
          -class naz.nazcodec.SimpleNazCodec(encoding='gsm0338', errors_level='strict')[source]
          -

          Bases: naz.nazcodec.BaseNazCodec

          -

          This is an implementation of BaseNazCodec.

          +
          +class naz.nazcodec.SimpleCodec(encoding='gsm0338')[source]
          +

          Bases: codecs.Codec

          +

          This is an implementation of codecs.Codec

          SMPP uses a 7-bit GSM character set. This class implements that encoding/decoding scheme. This class can also be used with the usual python standard encodings

          example usage:

          -
          ncodec = SimpleNazCodec(encoding="utf-16be")
          +
          ncodec = SimpleCodec(encoding="ucs2")
           
           ncodec.encode("Zoë")
           ncodec.decode(b'Zoë')
           
          -
          -__init__(encoding='gsm0338', errors_level='strict')[source]
          +
          +__init__(encoding='gsm0338')[source]
          Parameters
          -
            -
          • encoding (str) –

            encoding used to encode messages been sent to SMSC

            -

          • -
          • errors_level (str) –

            same meaning as the errors argument to pythons’ encode method

            -

          • -
          +

          encoding (str) – encoding used to encode messages been sent to SMSC +The encoding should be one of the encodings recognised by the SMPP specification. See section 5.2.19 of SMPP spec

          Return type

          None

          @@ -268,42 +197,44 @@
          -
          -decode(byte_string)[source]
          -

          return a string decoded from the given bytes.

          +
          +decode(input, errors='strict')[source]
          +

          Decodes the object input and returns a tuple (output +object, length consumed).

          +

          input must be an object which provides the bf_getreadbuf +buffer slot. Python strings, buffer objects and memory +mapped files are examples of objects providing this slot.

          +

          errors defines the error handling to apply. It defaults to +‘strict’ handling.

          +

          The method may not store state in the Codec instance. Use +StreamReader for codecs which have to keep state in order to +make decoding efficient.

          +

          The decoder must be able to handle zero length input and +return an empty object of the output object type in this +situation.

          -
          Parameters
          -
          -
          -
          Return type
          -

          str

          +
          Return type
          +

          Tuple[str, int]

          -
          -encode(string_to_encode)[source]
          -

          return an encoded version of the string as a bytes object

          +
          +encode(input, errors='strict')[source]
          +

          Encodes the object input and returns a tuple (output +object, length consumed).

          +

          errors defines the error handling to apply. It defaults to +‘strict’ handling.

          +

          The method may not store state in the Codec instance. Use +StreamWriter for codecs which have to keep state in order to +make encoding efficient.

          +

          The encoder must be able to handle zero length input and +return an empty object of the output object type in this +situation.

          -
          Parameters
          -
          -
          -
          Return type
          -

          bytes

          -
          -
          Returns
          -

          encoded version of input string

          +
          Return type
          +

          Tuple[bytes, int]

          diff --git a/docs/objects.inv b/docs/objects.inv index a98e3d96e26a653b4dfecb8f442d7341f5373779..1f7e2eca3e793591e47c609a08e98a2e4d451510 100644 GIT binary patch delta 1050 zcmV+#1m*ja3I7O?JOMS4Jv@I)bDJ;_fbael%(PcC?KQ`wk8~z!Gj;Eb3>!luBr1tK z`s=$w7D%=nOG*!Zu)E)~4_G7^`CD!Ue*jSoFBd&;MheA;!idUN_4J()uHP5y6`QTg zOCsTN25U;BEIxYNNuX@t&j=$-X9U&qCYl76L~go%plM;cNLf`K>r{VL<(w}yOOK7s zv!)#|<+aX;g00)Du4c&A!)1cT;YysxYToyRHC2mW6ogF18G~9SQVr1V5kw{XN`M@a z>8bQp4^omHq=u|J*9oX-#~$8*=0uJtNJX}^lWnC-S8Y4iBs-}At5-EdkwjDib~=Y^ zN7e8rmWqwr9xqARCvtyE5H{r~a_Td(Y$&Ox-^pJCe-?sI!wa5k7*xmEDUb^Rl&FJI zzKFv!VNvTjd*wNq=fi=Ivv9eCgS$4_!!Ra$Fe5ZOg+u(r(93X?QH>)XvGr&VHyT~|Yy9Vy%VEOC<-OoN-h8t5qB_qhokdc{DzVq6H z$HC@k`K16-x7X(B>6T!IPFja65WxXX)l^2de5B16I?DDuYD#v)ce{w3T;qh4Jj_=7 zB!QorH&AB>jQ4URDsTkT4)2+R=dL3UR>#%r;rJ7eZx%ncP)BYe_;Qka zu}8Tv*Tq``Ir0$hV5YBxw4`3e<1)`{i4_L>F)MX3H~WLHzyQy|y-N6Q;`oxmGp<$L zsB8{r+?g`GC7=@?!mY{lm7Jc!&iT#Jl5l4x&6U|oZt#C#lwS4=_zF=Tjk!p!0a=UA zEW9)DM?%NQ^M1mu6AtB$?V{3K%oB2Rpyb3HHX*A`KMeblM5X1}C-hoViS^USk12gZ zf01}*gO3P=HuegB1yU_OG8FYMbSn&A>$6f%kzf0R!1~X35<{1SQvQT{P`n+bKSeW~ zF|I0W(7b=unN?N|ZfIWqm$#&_%v{Sac#scI*ep-k%?rEBZeQ44egj|kcP_O3n`^0> zi-y<5+IvZg`u*!sNAJ8iDa`womGj=jHT1XF=nS5Tjumt4xohdljqPV6DJDyPUyM@E zB+PrY1J*>3b1z`n|FRU&$ zw|93od&HH%xl>QG-}AD_Z7`0d;!_fOJLN!jH-%yKdioxvH@vK^!WiC~QD_pK_g;=m zZwG>Y=e>txBQ_r`=MU0b z0h1+Id^4gGe~sVVbU94exx5#=#~+`py;+^-6i=W`7NRG&xQBmh7Xv27<&cq)QNHua zgV(|0X#1rAQn%OU>FK6mhE95iGZ4W6cGXlywtS?`7dp!JJZe&Q!*{!gm|W+CkUY$0 z{3L;YHE*Ey>SB$-;>?43UF%+LaT|m^`T=AMyZa6w8O4(u=8;2 z!R)x>dOiNc>zhT#ChABgf-fh#H}@zRvozi^kt2n01v9l0!jk$NgBxA1B-R+L$2_Q$ zx!GTQ1qOHz?q$N4iQ`KK&$wH6XJunJBWKd^mI<9u2$z2*Q!6<LMea3Q#k${rQby}#28nVb!gryW(TVVk905pOD$U=n+=}`%XReeotkw+sQbdicdl41EmAm^CV8I z*WLFhyy0bS2aMybX@w@x`Sj^XdM6OnozEVQkGC5~A9o+_xE<~g(Nh8ub?eX3*o?=< ojNc;RIbbz!X&gy!N2B$oCxPoQKM8Pjeg-%W-bzNFe^GpFA*zW4NdN!< diff --git a/docs/protocol.html b/docs/protocol.html index a38c9bf5..b69260b1 100644 --- a/docs/protocol.html +++ b/docs/protocol.html @@ -8,7 +8,7 @@ - protocol — naz v0.7.4 documentation + protocol — naz v0.7.5 documentation @@ -62,7 +62,7 @@
          - v0.7.4 + v0.7.5
          @@ -196,7 +196,7 @@
        • smpp_command (str) – any one of the SMSC commands eg submit_sm

        • log_id (str) – a unique identify of this reque

        • pdu (Union[None, bytes]) – the full PDU as sent to SMSC. It is mutually exclusive with short_message.

        • -
        • codec_class (Union[None, BaseNazCodec]) – python class instance to be used to encode/decode messages. It should be a child class of naz.nazcodec.BaseNazCodec. +

        • codec_class (Union[None, Codec]) – python class instance to be used to encode/decode messages. It should be a child class of codecs.Codec. You should only specify this, if you also specified pdu, else you can leave it as None.

        • short_message (Union[None, str]) – message to send to SMSC. It is mutually exclusive with pdu

        • source_addr (Union[None, str]) – the identifier(eg msisdn) of the message sender.

        • @@ -219,7 +219,7 @@
          Parameters
          • json_message (str) – naz.protocol.Message in json format.

          • -
          • codec_class (Union[None, BaseNazCodec]) – python class instance to be used to encode/decode messages. It should be a child class of naz.nazcodec.BaseNazCodec. +

          • codec_class (Union[None, Codec]) – python class instance to be used to encode/decode messages. It should be a child class of codecs.Codec. You should only specify this, if json_message has a key called pdu and it is not None.

          diff --git a/docs/py-modindex.html b/docs/py-modindex.html index 195bb8d0..75624677 100644 --- a/docs/py-modindex.html +++ b/docs/py-modindex.html @@ -8,7 +8,7 @@ - Python Module Index — naz v0.7.4 documentation + Python Module Index — naz v0.7.5 documentation @@ -63,7 +63,7 @@
          - v0.7.4 + v0.7.5
          diff --git a/docs/ratelimiter.html b/docs/ratelimiter.html index b6d8a070..204a43e3 100644 --- a/docs/ratelimiter.html +++ b/docs/ratelimiter.html @@ -8,7 +8,7 @@ - ratelimiter — naz v0.7.4 documentation + ratelimiter — naz v0.7.5 documentation @@ -62,7 +62,7 @@
          - v0.7.4 + v0.7.5
          diff --git a/docs/search.html b/docs/search.html index 4a4f6ec0..43b63485 100644 --- a/docs/search.html +++ b/docs/search.html @@ -8,7 +8,7 @@ - Search — naz v0.7.4 documentation + Search — naz v0.7.5 documentation @@ -61,7 +61,7 @@
          - v0.7.4 + v0.7.5
          diff --git a/docs/searchindex.js b/docs/searchindex.js index 0b0d3c4c..36bd007c 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["broker","client","correlater","example_demo","hooks","index","introduction","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["broker.rst","client.rst","correlater.rst","example_demo.rst","hooks.rst","index.rst","introduction.rst","log.rst","nazcodec.rst","protocol.rst","ratelimiter.rst","sequence.rst","state.rst","throttle.rst"],objects:{"naz.broker":{BaseBroker:[0,1,1,""],SimpleBroker:[0,1,1,""]},"naz.broker.BaseBroker":{dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.broker.SimpleBroker":{__init__:[0,2,1,""],dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.client":{Client:[1,1,1,""],NazClientError:[1,3,1,""]},"naz.client.Client":{__init__:[1,2,1,""],command_handlers:[1,2,1,""],connect:[1,2,1,""],deliver_sm_resp:[1,2,1,""],dequeue_messages:[1,2,1,""],enquire_link:[1,2,1,""],enquire_link_resp:[1,2,1,""],re_establish_conn_bind:[1,2,1,""],receive_data:[1,2,1,""],send_data:[1,2,1,""],shutdown:[1,2,1,""],submit_sm:[1,2,1,""],tranceiver_bind:[1,2,1,""],unbind:[1,2,1,""],unbind_resp:[1,2,1,""]},"naz.correlater":{BaseCorrelater:[2,1,1,""],SimpleCorrelater:[2,1,1,""]},"naz.correlater.BaseCorrelater":{get:[2,2,1,""],put:[2,2,1,""]},"naz.correlater.SimpleCorrelater":{__init__:[2,2,1,""],get:[2,2,1,""],put:[2,2,1,""]},"naz.hooks":{BaseHook:[4,1,1,""],SimpleHook:[4,1,1,""]},"naz.hooks.BaseHook":{from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.hooks.SimpleHook":{__init__:[4,2,1,""],from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.log":{BreachHandler:[7,1,1,""],SimpleLogger:[7,1,1,""]},"naz.log.BreachHandler":{__init__:[7,2,1,""],emit:[7,2,1,""],shouldFlush:[7,2,1,""]},"naz.log.SimpleLogger":{__init__:[7,2,1,""],log:[7,2,1,""]},"naz.nazcodec":{BaseNazCodec:[8,1,1,""],SimpleCodec:[8,1,1,""]},"naz.nazcodec.BaseNazCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.nazcodec.SimpleCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.protocol":{Message:[9,1,1,""]},"naz.protocol.Message":{__init__:[9,2,1,""],from_json:[9,2,1,""],to_json:[9,2,1,""]},"naz.ratelimiter":{BaseRateLimiter:[10,1,1,""],SimpleRateLimiter:[10,1,1,""]},"naz.ratelimiter.BaseRateLimiter":{limit:[10,2,1,""]},"naz.ratelimiter.SimpleRateLimiter":{__init__:[10,2,1,""],limit:[10,2,1,""]},"naz.sequence":{BaseSequenceGenerator:[11,1,1,""],SimpleSequenceGenerator:[11,1,1,""]},"naz.sequence.BaseSequenceGenerator":{next_sequence:[11,2,1,""]},"naz.sequence.SimpleSequenceGenerator":{__init__:[11,2,1,""],next_sequence:[11,2,1,""]},"naz.state":{CommandStatus:[12,1,1,""],DataCoding:[12,1,1,""],SmppCommand:[12,1,1,""],SmppCommandStatus:[12,1,1,""],SmppDataCoding:[12,1,1,""],SmppOptionalTag:[12,1,1,""],SmppSessionState:[12,1,1,""]},"naz.state.CommandStatus":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.state.DataCoding":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.throttle":{BaseThrottleHandler:[13,1,1,""],SimpleThrottleHandler:[13,1,1,""]},"naz.throttle.BaseThrottleHandler":{allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},"naz.throttle.SimpleThrottleHandler":{__init__:[13,2,1,""],allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},naz:{broker:[0,0,0,"-"],client:[1,0,0,"-"],correlater:[2,0,0,"-"],hooks:[4,0,0,"-"],log:[7,0,0,"-"],nazcodec:[8,0,0,"-"],protocol:[9,0,0,"-"],ratelimiter:[10,0,0,"-"],sequence:[11,0,0,"-"],state:[12,0,0,"-"],throttle:[13,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception"},terms:{"0r5nd6bsd3g4atwux":3,"16be":8,"20min":6,"2billion":2,"7wjf935mqgsjplq7e":3,"\u03c3cmt":3,"\u30c4":6,"abstract":[0,2,4,8,10,11,13],"byte":[1,4,8,9],"class":[0,1,2,3,4,6,7,8,9,10,11,12,13],"default":[6,7],"final":6,"float":[1,2,7,10,13],"function":1,"h\u00fclk":[],"import":[1,3,6,7,9,10,13],"int":[0,1,2,7,9,11],"long":[3,6,13],"return":[0,1,2,3,4,6,7,8,9,10,11,13],"short":[1,6],"static":9,"super":6,"true":[3,7],"try":6,"while":[1,3],"zo\u00e3":8,"zo\u00eb":8,AND:13,AWS:3,And:[3,6],But:3,For:[3,6],One:2,REs:6,SMS:1,SQS:3,That:[1,6],The:[0,1,2,3,6,9,11,13],With:3,__init__:[0,1,2,3,4,6,7,8,9,10,11,13],_get_redi:3,_handler:7,_parse_response_pdu:1,_process_msg:6,_redi:3,abc:[0,2,4,8,10,11,13],abil:6,abl:[0,3,9],about:6,abov:[6,13],accept:3,acct:1,accur:[4,11],acknowledg:1,activ:[1,6],addhandl:[6,7],addit:1,addr_npi:1,addr_ton:1,address:[1,3],address_rang:1,after:[1,2,4,6,13],again:13,agnost:3,aha:7,aioredi:3,algorithm:[6,10],alia:12,all:[3,6,7],allow:[6,10,11],allow_request:13,alpin:3,also:[1,2,3,6,8,9,13],altern:7,among:2,ani:[1,2,3,4,6,9,13],annot:6,anoth:[2,3,6],anymor:13,anyth:6,api:6,app:[3,5],append:7,appli:7,applic:[1,2,3,4,6,9],arg:[6,7],argument:[3,7,8],around:[2,11],arrang:1,articl:7,artist:6,associ:1,async:[0,1,2,3,4,10,13],asynchron:1,asyncio:[1,3,6],attach:7,authent:1,auto:2,avail:3,await:[3,6,10],awesom:3,awesomestor:3,b526gdnxfbf8sqlzz:3,backward:6,band:6,base:[0,1,2,4,7,8,9,10,11,12,13],basebrok:[0,1,3,6],basecorrelat:[1,2],basehook:[1,4,6],basenazcodec:[1,8,9],baseratelimit:[1,6,10],basesequencegener:[1,11],basethrottlehandl:[1,6,13],basi:2,been:[1,3,7,8],befor:[1,3,4,6,7,13],benchmark:5,best:2,between:[1,2,6],bind:[1,6],bind_receiv:1,bind_transceiv:1,bind_transceiver_resp:1,bit:[7,8],block:1,bodi:1,body_data:1,bool:[1,7,13],both:3,breachhandl:7,bring:6,broker:[1,3,5,9],brpop:3,bucket:[6,10],buffer:[1,7],bug:5,busi:3,byte_str:8,calcul:13,call:[0,1,2,3,4,6,7,8,9,13],can:[0,1,3,6,7,8,9,10,12],capac:7,center:6,certain:7,chang:[3,6],charact:8,check:[1,6,7],child:9,choic:[3,6],cleanli:1,cli:[3,5],client:[3,6,9,10,13],client_id:[1,3,6],close:[6,7],cmt:1,code:[1,3,9,12],codec:8,codec_class:[1,9],com:7,come:2,command:[2,3,4,9,12],command_handl:[1,3],command_statu:3,command_status_valu:1,commandlin:6,commandstatu:[4,12],commit:6,commun:3,compos:6,condit:[7,13],config:6,confirm:3,conn:6,connect:[1,3,6],connection_lost:3,consult:[3,6],consum:6,contain:[3,6],content:6,continu:[1,6],control:[1,6,10],correl:[2,4,9,11],correlat:5,correlatinid:6,correlation_handl:1,could:7,counter:6,creat:[3,6],create_redis_pool:3,cthank:3,current:[3,6,9],cursor:6,custom:[3,6,10],damn:7,data:[1,4,6,12],databas:6,datacod:12,debug:[6,7],decid:[6,7,13],decis:13,declar:[1,6],decod:[1,3,8,9],def:[3,6],defin:8,delet:2,deliv:6,deliver_sm:[2,6],deliver_sm_resp:1,deliveri:[1,2,6],demo:[0,5,6],demo_naz:3,deni:[6,13],deny_request_at:[6,13],depend:6,dequed_item:3,dequeu:[0,1,3,6],dequeue_messag:[1,3,6],deriv:6,descript:[6,12],deseri:9,design:[1,6],dest_addr_npi:1,dest_addr_ton:1,destin:1,destination_addr:[1,3,6,9],determin:13,develop:[3,6],diagnost:7,dict:[1,7],dictionari:2,did:7,differ:[1,2,4,9],directori:[3,6],doc:6,docker:[3,6],document:3,doe:[1,6,7,10,13],domain:1,done:[2,3],dot:[3,6],drain_dur:1,dry:3,durat:[1,13],each:6,effort:2,elliot:7,els:[3,9],emit:7,emoji:6,empti:3,enabl:[9,13],encod:[1,8,9,12],end:3,enqueu:[0,1,3,6],enquire_link:[1,6],enquire_link_interv:1,enquire_link_resp:1,entiti:6,environ:6,error:[1,6,7,8],errors_level:8,esm:[1,6],esm_class:1,esme_rmsgq:13,esme_rthrottl:6,etc:[3,7,8,9],even:[6,7],event:[3,6,7],everi:7,everytim:13,everywher:5,evolv:9,exampl:[1,5,6,7,8,10],example_config:6,examplebrok:6,exc_info:7,exce:13,exceed:7,except:[1,6,7],exclus:9,execut:[3,6],exist:1,exit:3,expect:3,expir:2,extern:6,fals:[1,3,7,13],featur:[2,5],field:[1,12],file:[3,6,7],flag:1,flow:1,flush:7,flushlevel:7,flushonclos:7,forc:3,format:[3,6,9],formatt:[6,7],found:6,from:[1,2,3,4,6,7,8,9,13],from_json:[0,3,9],from_smsc:[4,6],full:[1,4,9,13],futur:9,gatewai:[1,6],gather:[1,6],gener:[1,6,11],get:[1,2,3,6,9,13],get_event_loop:[1,3,6],getenv:1,getlogg:7,give:[3,6],given:[2,7,8],goe:13,going:[2,3],good:[6,7],googl:7,got:[7,13],greater:[6,13],gsm0338:8,gsm:8,guarante:2,had:[2,3,4],hand:1,handl:[3,5,13],handler:[1,6,7,13],happen:6,happili:3,has:[0,6,9],hasn:7,have:[3,6,7,13],heartbeat:7,heartbeatinterv:7,hello:[6,9],help:[3,4,11],here:6,higher:7,hip:6,hold:6,hook:[1,3,5,9],hook_metadata1:2,hook_metadata2:2,hook_metadata:[1,2,4,6,9],hop:6,host:[1,3,6],houston:7,how:[3,6,13],howev:[2,3],http:[6,7],ident:1,identifi:[1,2,9],ignor:[],implement:[0,1,2,3,4,6,7,8,10,11,13],implemet:1,implemnet:3,impos:13,inc:6,includ:[3,7],incompat:6,increas:11,increment:6,indic:[1,9],info:[6,7],inform:[6,7],inherit:[0,2,4,8,10,11,13],init:6,initi:[4,11],inject:6,input:8,insid:3,inspir:7,instal:[3,5],instanc:[0,1,3,6,9],instantait:3,instanti:[1,3],integ:[7,11],integr:5,interact:1,interfac:[0,2,3,4,6,8,10,11,13],interface_vers:1,introduct:5,issu:6,item:[0,1,2,3,6],its:[1,3],itself:13,jayz:7,join:6,json:[0,7,9],json_messag:9,just:[1,4,6,13],kafka:3,keep:6,kei:[2,6,9],kenyan:6,keyword:7,klqk248jsk8:3,komuw:3,kvlog:6,kvlogger:6,kwarg:[6,7],last:13,later:[1,6,9],learn:3,least:7,leav:9,let:[3,6,10],level:[1,6,7],leverag:6,librari:5,like:[1,2,6,7,9],limit:[1,3,5,10,13],line:3,list:1,listen:[1,3],load:[6,13],localhost:3,log:[1,3,4,5,9],log_id1:2,log_id2:2,log_id:[1,2,3,4,6,9],log_metadata:[6,7],logger:[1,4,6,7,10,13],logger_nam:7,logic:3,look:[2,3,6],loop:[1,3,6],lost:1,lot:3,lpush:3,mai:[2,4,6,9,10,13],main:3,make:[1,3,6,13],mandat:2,manner:6,max_ttl:2,maximum:[0,7,10,11],maxsiz:[0,1,3,6],mean:8,mechan:[1,6],memori:[0,2,7],memoryhandl:7,messag:[0,1,2,3,4,6,7,8,9,10,13],met:7,metadata:[1,7],method:[0,1,2,4,6,8,9,10,11,13],metric:6,minimum:13,minsiz:3,minut:7,missi:7,mkdir:3,mode:1,monitor:5,monoton:11,more:[3,6,13],mostli:7,msg:[1,3,6,7,9],msisdn:[1,9],much:3,must:[0,2,4,8,10,11,13],mutual:9,my_app:6,my_brok:[3,6],my_client:3,my_config:6,my_naz_cli:[3,6],my_request:6,my_respons:6,myfil:6,myhook:6,myid12345:6,mylimit:6,mylogg:7,myprometheushook:6,myredisbrok:3,mysmsdb:6,mysteri:7,name:[1,6,7],naz:[0,1,2,4,7,8,9,10,11,12,13],naz_benchmarks_queu:3,nazclienterror:1,nazcodec:[5,9],nazizi:6,ncodec:8,neccesari:0,need:[3,6],network:1,new_msg:6,next:3,next_sequ:11,none:[0,1,2,3,4,7,8,9,10,11,13],not_throttl:13,note:[0,2],notif:[2,6],notset:[],now:3,npi:1,number:[0,1,2,6,7,12,13],object:[1,8,9,12],observ:5,occur:6,ofcours:6,off:3,okai:3,omit:2,onc:3,one:[2,3,4,9],onli:[0,3,6,7,9],option:[2,3,12],order:[0,3],origin:1,other:[2,3,6],ought:11,our:3,out:[1,3,6],outgo:6,over:[1,6,13],own:[3,6],paramet:[0,1,2,4,6,7,8,9,10,12,13],pars:1,parti:6,particular:[2,3,13],pass:[1,3,6,7,9],password:[1,3,6],path:[3,6],pdu:[1,4,6,9],per:[6,7],percent:13,percentag:[6,13],period:[1,6],pid:3,pip:[3,6],place:[3,6],plan:1,port:[1,3],possibl:3,postgr:9,predefin:1,previous:[2,4],print:6,prioriti:1,priority_flag:1,problem:7,process:7,prod:3,product:6,prometheu:6,prometheus_cli:6,properti:12,protocol:[0,1,3,5,6],protocol_id:1,purchas:3,purpos:[0,6],put:[0,2,7],put_nowait:6,python3:6,python:[1,2,3,6,7,8,9],python_path:3,queu:[1,6,9],queue:[0,1,3,6,13],queue_nam:3,rabbitmq:[3,6,9],rais:1,rang:[1,6,11],rate:[1,3,5,10,13],ratelimit:[1,5,6],re_establish_conn_bind:1,reach:11,read:[1,6],readi:3,real:3,reason:[2,6,13],rebind:1,receipt:1,receipted_message_id:2,receiv:[1,4,9],receive_data:[1,3,6],recipi:1,reconnect:1,record:[6,7],redi:[3,6,9],registered_deliveri:1,regul:13,relat:[1,2,3],releas:6,reliabl:2,render:[6,7],replac:[1,3],replace_if_present_flag:1,repli:[6,13],repo:6,represenst:12,represent:9,requ:9,request:[1,4,6,10,11,13],requir:[1,6],respect:1,respond:13,respons:[1,3,4,6,11,13],ring:7,round:6,rout:[1,6],run:[1,3,6],run_until_complet:[1,3,6],sai:6,said:1,same:8,sample_s:[6,13],sampling_period:[6,13],san:6,satisfi:[0,2,3,4,6,8,10,11,13],save:[0,9],schedul:1,schedule_delivery_tim:1,scheme:8,sdk:6,second:[1,2,6,7,10,13],see:[3,4,11],self:[3,4,6,11,13],send:[1,3,4,6,9,10,13],send_data:[1,3],send_messag:3,send_messsag:10,send_rat:[6,10],send_request:3,sender:[1,9],sens:6,sent:[1,3,4,8,9],sentri:6,sentry_sdk:6,sequenc:[1,2,5],sequence_gener:1,sequence_numb:[1,2,11],sequence_number1:2,serial:[0,9],serv:1,server:[1,3,6,10],servic:[1,6],service_typ:1,session:[1,12],set:[3,6,7,8],setformatt:[6,7],setlevel:[6,7],setmessagestatehook:6,setup:6,sever:7,ship:[3,6,9],shoe:3,shop:9,short_messag:[1,3,6,9],should:[0,1,2,3,4,6,7,8,9,10,11,13],shouldflush:7,show:[3,6],shown:[0,2,4,8,10,11,13],shutdown:1,signal:1,signatur:[0,2,4,8,10,11,13],signifi:1,simpl:[2,6],simplebrok:[0,1,6],simplecorrelat:2,simplehook:[4,6],simplelogg:[6,7],SimpleCodec:8,simpleratelimit:[6,10],simplesequencegener:11,simplethrottlehandl:[6,13],simul:[3,6],singl:1,size:0,sleep:3,sm_default_msg_id:1,sme:1,smpp:[1,2,3,6,8,11,12,13],smpp_command:[1,2,3,4,6,9],smpp_server:3,smppclient1:[1,3,6],smppcommand:[6,9,12],smppcommandstatu:12,smppdatacod:12,smppoptionaltag:12,smppsessionst:12,smsc:[1,2,3,4,6,8,9,10,13],smsc_host:[1,3,6],smsc_message_id1:2,smsc_message_id:2,smsc_port:[1,3,6],smstabl:6,socket:1,socket_timeout:1,softwar:3,some:[1,9],sometim:6,sourc:[0,1,2,4,7,8,9,10,11,12,13],source_addr:[1,3,6,9],source_addr_npi:1,source_addr_ton:1,specif:[1,11],specifi:[2,6,9,10],sql:6,sqlite3:6,stage:3,standard:8,standardconnectionhandl:3,start:[1,3,6,13],state:[1,3,4,5,6],statehook:6,statement:7,statu:[1,4,6,12,13],status:12,stderr:[],stdlib:7,stdout:7,stop:6,storag:2,store:[0,1,2,3,7],stored_at:2,str:[1,2,4,6,7,8,9],stream:7,streamhandl:[6,7],strict:8,string:[0,1,2,4,8,9],string_to_encod:8,structur:7,style:6,submit:[1,3],submit_sm:[1,2,3,4,6,9],submit_sm_resp:[2,3,4],success:3,suppli:[2,4,6],support:[1,6],suppos:6,surpass:6,system:1,system_id:[1,3,6],system_typ:1,tabl:6,tag:[2,12],take:[3,6],taken:7,talk:[3,6],target:7,targetlevel:7,task:[1,6],tell:7,termin:[1,6],test:[0,1,6],than:[6,13],thank:[3,9],thei:3,them:1,thi:[0,1,2,3,4,6,7,8,9,10,11,13],thing:3,third:6,those:6,throtll:[6,13],throttl:[1,3,5],throttle_delai:13,throttle_handl:[1,6],throttle_wait:13,throttler:6,through:3,thu:[6,13],time:[1,2,13],timeout:3,timestamp:3,tmp:[3,6],to_json:[0,3,9],to_smsc:[4,6],todo:1,token:[6,10],total:[6,13],track:[2,3,4],tracker:5,tracking_cod:3,tranceiver_bind:[1,6],transceiv:1,transfer:6,trigger:7,tupl:[2,12],tweet:7,two:6,type:[0,1,2,4,7,8,9,10,11,13],typic:3,ultim:[],unbind:[1,6],unbind_resp:1,under:[6,13],union:[1,2,7,9],uniqu:[1,2,7,9],updat:6,upto:6,url:7,usag:[3,5,7,8,9,10],use:[0,2,3,6,7,9],used:[0,1,3,6,7,8,9],user:[0,1,2,4,8,10,11,13],uses:[1,2,6,8],using:[1,2,5,6,10],usual:[6,8],utf8:[],utf:8,valid:1,validity_period:1,valu:[2,6,7,12],variou:[1,3,12],version:[1,3,6,8,9],via:[1,6,13],wai:[3,6,13],wait:[1,3,13],want:[2,3,4,6],watch:6,web_request:7,wether:13,what:[1,3,6,9],whatev:[6,13],when:[1,3,4,6,7,11,13],whenev:6,where:[3,6],wherea:3,whether:[1,3,7],which:[1,3,6,7,10,11,12,13],who:3,wikipedia:6,work:[6,13],world:6,would:[1,6,9],wrap:[2,11],write:[1,6],www:7,you:[0,1,3,6,7,9,10],your:[3,6,9],your_sentry_project_id:6,your_sentry_public_kei:6},titles:["broker","Client","correlater","Example demo of using naz","hooks","naz - naz is an async SMPP client.","Introduction to naz","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],titleterms:{api:5,app:6,async:[5,6],benchmark:6,broker:[0,6],bug:6,cli:6,client:[1,5],content:5,correlat:2,demo:3,everywher:6,exampl:3,featur:6,handl:6,hook:[4,6],instal:6,integr:6,introduct:6,librari:6,limit:6,log:[6,7],monitor:6,naz:[3,5,6],nazcodec:8,observ:6,protocol:9,rate:6,ratelimit:10,refer:5,sequenc:11,smpp:5,state:12,throttl:[6,13],tracker:6,usag:6,using:3}}) \ No newline at end of file +Search.setIndex({docnames:["broker","client","correlater","example_demo","hooks","index","introduction","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["broker.rst","client.rst","correlater.rst","example_demo.rst","hooks.rst","index.rst","introduction.rst","log.rst","nazcodec.rst","protocol.rst","ratelimiter.rst","sequence.rst","state.rst","throttle.rst"],objects:{"naz.broker":{BaseBroker:[0,1,1,""],SimpleBroker:[0,1,1,""]},"naz.broker.BaseBroker":{dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.broker.SimpleBroker":{__init__:[0,2,1,""],dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.client":{Client:[1,1,1,""],NazClientError:[1,3,1,""]},"naz.client.Client":{__init__:[1,2,1,""],command_handlers:[1,2,1,""],connect:[1,2,1,""],deliver_sm_resp:[1,2,1,""],dequeue_messages:[1,2,1,""],enquire_link:[1,2,1,""],enquire_link_resp:[1,2,1,""],re_establish_conn_bind:[1,2,1,""],receive_data:[1,2,1,""],send_data:[1,2,1,""],shutdown:[1,2,1,""],submit_sm:[1,2,1,""],tranceiver_bind:[1,2,1,""],unbind:[1,2,1,""],unbind_resp:[1,2,1,""]},"naz.correlater":{BaseCorrelater:[2,1,1,""],SimpleCorrelater:[2,1,1,""]},"naz.correlater.BaseCorrelater":{get:[2,2,1,""],put:[2,2,1,""]},"naz.correlater.SimpleCorrelater":{__init__:[2,2,1,""],get:[2,2,1,""],put:[2,2,1,""]},"naz.hooks":{BaseHook:[4,1,1,""],SimpleHook:[4,1,1,""]},"naz.hooks.BaseHook":{from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.hooks.SimpleHook":{__init__:[4,2,1,""],from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.log":{BreachHandler:[7,1,1,""],SimpleLogger:[7,1,1,""]},"naz.log.BreachHandler":{__init__:[7,2,1,""],emit:[7,2,1,""],shouldFlush:[7,2,1,""]},"naz.log.SimpleLogger":{__init__:[7,2,1,""],log:[7,2,1,""]},"naz.nazcodec":{SimpleCodec:[8,1,1,""]},"naz.nazcodec.SimpleCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.protocol":{Message:[9,1,1,""]},"naz.protocol.Message":{__init__:[9,2,1,""],from_json:[9,2,1,""],to_json:[9,2,1,""]},"naz.ratelimiter":{BaseRateLimiter:[10,1,1,""],SimpleRateLimiter:[10,1,1,""]},"naz.ratelimiter.BaseRateLimiter":{limit:[10,2,1,""]},"naz.ratelimiter.SimpleRateLimiter":{__init__:[10,2,1,""],limit:[10,2,1,""]},"naz.sequence":{BaseSequenceGenerator:[11,1,1,""],SimpleSequenceGenerator:[11,1,1,""]},"naz.sequence.BaseSequenceGenerator":{next_sequence:[11,2,1,""]},"naz.sequence.SimpleSequenceGenerator":{__init__:[11,2,1,""],next_sequence:[11,2,1,""]},"naz.state":{CommandStatus:[12,1,1,""],DataCoding:[12,1,1,""],SmppCommand:[12,1,1,""],SmppCommandStatus:[12,1,1,""],SmppDataCoding:[12,1,1,""],SmppOptionalTag:[12,1,1,""],SmppSessionState:[12,1,1,""]},"naz.state.CommandStatus":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.state.DataCoding":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.throttle":{BaseThrottleHandler:[13,1,1,""],SimpleThrottleHandler:[13,1,1,""]},"naz.throttle.BaseThrottleHandler":{allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},"naz.throttle.SimpleThrottleHandler":{__init__:[13,2,1,""],allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},naz:{broker:[0,0,0,"-"],client:[1,0,0,"-"],correlater:[2,0,0,"-"],hooks:[4,0,0,"-"],log:[7,0,0,"-"],nazcodec:[8,0,0,"-"],protocol:[9,0,0,"-"],ratelimiter:[10,0,0,"-"],sequence:[11,0,0,"-"],state:[12,0,0,"-"],throttle:[13,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception"},terms:{"0r5nd6bsd3g4atwux":3,"16be":[],"20min":6,"2billion":2,"7wjf935mqgsjplq7e":3,"\u03c3cmt":3,"\u30c4":6,"abstract":[0,2,4,10,11,13],"byte":[1,4,8,9],"class":[0,1,2,3,4,6,7,8,9,10,11,12,13],"default":[6,7,8],"final":6,"float":[1,2,7,10,13],"function":1,"h\u00fclk":[],"import":[1,3,6,7,9,10,13],"int":[0,1,2,7,8,9,11],"long":[3,6,13],"return":[0,1,2,3,4,6,7,8,9,10,11,13],"short":[1,6],"static":9,"super":6,"true":[3,7],"try":6,"while":[1,3],"zo\u00e3":8,"zo\u00eb":8,AND:13,AWS:3,And:[3,6],But:3,For:[3,6],One:2,REs:6,SMS:1,SQS:3,SimpleCodec:[],That:[1,6],The:[0,1,2,3,6,8,9,11,13],Use:8,With:3,__init__:[0,1,2,3,4,6,7,8,9,10,11,13],_get_redi:3,_handler:7,_parse_response_pdu:1,_process_msg:6,_redi:3,abc:[0,2,4,10,11,13],abil:6,abl:[0,3,8,9],about:6,abov:[6,13],accept:3,acct:1,accur:[4,11],acknowledg:1,activ:[1,6],addhandl:[6,7],addit:1,addr_npi:1,addr_ton:1,address:[1,3],address_rang:1,after:[1,2,4,6,13],again:13,agnost:3,aha:7,aioredi:3,algorithm:[6,10],alia:12,all:[3,6,7],allow:[6,10,11],allow_request:13,alpin:3,also:[1,2,3,6,8,9,13],altern:7,among:2,ani:[1,2,3,4,6,9,13],annot:6,anoth:[2,3,6],anymor:13,anyth:6,api:6,app:[3,5],append:7,appli:[7,8],applic:[1,2,3,4,6,9],arg:[6,7],argument:[3,7],around:[2,11],arrang:1,articl:7,artist:6,associ:1,async:[0,1,2,3,4,10,13],asynchron:1,asyncio:[1,3,6],attach:7,authent:1,auto:2,avail:3,await:[3,6,10],awesom:3,awesomestor:3,b526gdnxfbf8sqlzz:3,backward:6,band:6,base:[0,1,2,4,7,8,9,10,11,12,13],basebrok:[0,1,3,6],basecorrelat:[1,2],basehook:[1,4,6],basenazcodec:[],baseratelimit:[1,6,10],basesequencegener:[1,11],basethrottlehandl:[1,6,13],basi:2,been:[1,3,7,8],befor:[1,3,4,6,7,13],benchmark:5,best:2,between:[1,2,6],bf_getreadbuf:8,bind:[1,6],bind_receiv:1,bind_transceiv:1,bind_transceiver_resp:1,bit:[7,8],block:1,bodi:1,body_data:1,bool:[1,7,13],both:3,breachhandl:7,bring:6,broker:[1,3,5,9],brpop:3,bucket:[6,10],buffer:[1,7,8],bug:5,busi:3,byte_str:[],calcul:13,call:[0,1,2,3,4,6,7,9,13],can:[0,1,3,6,7,8,9,10,12],capac:7,center:6,certain:7,chang:[3,6],charact:8,check:[1,6,7],child:[1,9],choic:[3,6],cleanli:1,cli:[3,5],client:[3,6,9,10,13],client_id:[1,3,6],close:[6,7],cmt:1,code:[1,3,9,12],codec:[1,8,9],codec_class:[1,9],com:7,come:2,command:[2,3,4,9,12],command_handl:[1,3],command_statu:3,command_status_valu:1,commandlin:6,commandstatu:[4,12],commit:6,commun:3,compos:6,condit:[7,13],config:6,confirm:3,conn:6,connect:[1,3,6],connection_lost:3,consult:[3,6],consum:[6,8],contain:[3,6],content:6,continu:[1,6],control:[1,6,10],correl:[2,4,9,11],correlat:5,correlatinid:6,correlation_handl:1,could:7,counter:6,creat:[3,6],create_redis_pool:3,cthank:3,current:[3,6,9],cursor:6,custom:[3,6,10],damn:7,data:[1,4,6,12],databas:6,datacod:12,debug:[6,7],decid:[6,7,13],decis:13,declar:[1,6],decod:[1,3,8,9],def:[3,6],defin:8,delet:2,deliv:6,deliver_sm:[2,6],deliver_sm_resp:1,deliveri:[1,2,6],demo:[0,5,6],demo_naz:3,deni:[6,13],deny_request_at:[6,13],depend:6,dequed_item:3,dequeu:[0,1,3,6],dequeue_messag:[1,3,6],deriv:6,descript:[6,12],deseri:9,design:[1,6],dest_addr_npi:1,dest_addr_ton:1,destin:1,destination_addr:[1,3,6,9],determin:13,develop:[3,6],diagnost:7,dict:[1,7],dictionari:2,did:7,differ:[1,2,4,9],directori:[3,6],doc:6,docker:[3,6],document:3,doe:[1,6,7,10,13],domain:1,done:[2,3],dot:[3,6],drain_dur:1,dry:3,durat:[1,13],each:6,effici:8,effort:2,elliot:7,els:[3,9],emit:7,emoji:6,empti:[3,8],enabl:[9,13],encod:[1,8,9,12],end:3,enqueu:[0,1,3,6],enquire_link:[1,6],enquire_link_interv:1,enquire_link_resp:1,entiti:6,environ:6,error:[1,6,7,8],errors_level:[],esm:[1,6],esm_class:1,esme_rmsgq:13,esme_rthrottl:6,etc:[3,7,9],even:[6,7],event:[3,6,7],everi:7,everytim:13,everywher:5,evolv:9,exampl:[1,5,6,7,8,10],example_config:6,examplebrok:6,exc_info:7,exce:13,exceed:7,except:[1,6,7],exclus:9,execut:[3,6],exist:1,exit:3,expect:3,expir:2,extern:6,fals:[1,3,7,13],featur:[2,5],field:[1,12],file:[3,6,7,8],flag:1,flow:1,flush:7,flushlevel:7,flushonclos:7,forc:3,format:[3,6,9],formatt:[6,7],found:6,from:[1,2,3,4,6,7,9,13],from_json:[0,3,9],from_smsc:[4,6],full:[1,4,9,13],futur:9,gatewai:[1,6],gather:[1,6],gener:[1,6,11],get:[1,2,3,6,9,13],get_event_loop:[1,3,6],getenv:1,getlogg:7,give:[3,6],given:[2,7],goe:13,going:[2,3],good:[6,7],googl:7,got:[7,13],greater:[6,13],gsm0338:8,gsm:8,guarante:2,had:[2,3,4],hand:1,handl:[3,5,8,13],handler:[1,6,7,13],happen:6,happili:3,has:[0,6,9],hasn:7,have:[3,6,7,8,13],heartbeat:7,heartbeatinterv:7,hello:[6,9],help:[3,4,11],here:6,higher:7,hip:6,hold:6,hook:[1,3,5,9],hook_metadata1:2,hook_metadata2:2,hook_metadata:[1,2,4,6,9],hop:6,host:[1,3,6],houston:7,how:[3,6,13],howev:[2,3],http:[6,7],ident:1,identifi:[1,2,9],ignor:[],implement:[0,1,2,3,4,6,7,8,10,11,13],implemet:1,implemnet:3,impos:13,inc:6,includ:[3,7],incompat:6,increas:11,increment:6,indic:[1,9],info:[6,7],inform:[6,7],inherit:[0,2,4,10,11,13],init:6,initi:[4,11],inject:6,input:8,insid:3,inspir:7,instal:[3,5],instanc:[0,1,3,6,8,9],instantait:3,instanti:[1,3],integ:[7,11],integr:5,interact:1,interfac:[0,2,3,4,6,10,11,13],interface_vers:1,introduct:5,issu:6,item:[0,1,2,3,6],its:[1,3],itself:13,jayz:7,join:6,json:[0,7,9],json_messag:9,just:[1,4,6,13],kafka:3,keep:[6,8],kei:[2,6,9],kenyan:6,keyword:7,klqk248jsk8:3,komuw:3,kvlog:6,kvlogger:6,kwarg:[6,7],last:13,later:[1,6,9],learn:3,least:7,leav:9,length:8,let:[3,6,10],level:[1,6,7],leverag:6,librari:5,like:[1,2,6,7,9],limit:[1,3,5,10,13],line:3,list:1,listen:[1,3],load:[6,13],localhost:3,log:[1,3,4,5,9],log_id1:2,log_id2:2,log_id:[1,2,3,4,6,9],log_metadata:[6,7],logger:[1,4,6,7,10,13],logger_nam:7,logic:3,look:[2,3,6],loop:[1,3,6],lost:1,lot:3,lpush:3,mai:[2,4,6,8,9,10,13],main:3,make:[1,3,6,8,13],mandat:2,manner:6,map:8,max_ttl:2,maximum:[0,7,10,11],maxsiz:[0,1,3,6],mean:[],mechan:[1,6],memori:[0,2,7,8],memoryhandl:7,messag:[0,1,2,3,4,6,7,8,9,10,13],met:7,metadata:[1,7],method:[0,1,2,4,6,8,9,10,11,13],metric:6,minimum:13,minsiz:3,minut:7,missi:7,mkdir:3,mode:1,monitor:5,monoton:11,more:[3,6,13],mostli:7,msg:[1,3,6,7,9],msisdn:[1,9],much:3,must:[0,2,4,8,10,11,13],mutual:9,my_app:6,my_brok:[3,6],my_client:3,my_config:6,my_naz_cli:[3,6],my_request:6,my_respons:6,myfil:6,myhook:6,myid12345:6,mylimit:6,mylogg:7,myprometheushook:6,myredisbrok:3,mysmsdb:6,mysteri:7,name:[1,6,7],naz:[0,1,2,4,7,8,9,10,11,12,13],naz_benchmarks_queu:3,nazclienterror:1,nazcodec:5,nazizi:6,ncodec:8,neccesari:0,need:[3,6],network:1,new_msg:6,next:3,next_sequ:11,none:[0,1,2,3,4,7,8,9,10,11,13],not_throttl:13,note:[0,2],notif:[2,6],notset:[],now:3,npi:1,number:[0,1,2,6,7,12,13],object:[1,8,9,12],observ:5,occur:6,ofcours:6,off:3,okai:3,omit:2,onc:3,one:[2,3,4,8,9],onli:[0,3,6,7,9],option:[2,3,12],order:[0,3,8],origin:1,other:[2,3,6],ought:11,our:3,out:[1,3,6],outgo:6,output:8,over:[1,6,13],own:[3,6],paramet:[0,1,2,4,6,7,8,9,10,12,13],pars:1,parti:6,particular:[2,3,13],pass:[1,3,6,7,9],password:[1,3,6],path:[3,6],pdu:[1,4,6,9],per:[6,7],percent:13,percentag:[6,13],period:[1,6],pid:3,pip:[3,6],place:[3,6],plan:1,port:[1,3],possibl:3,postgr:9,predefin:1,previous:[2,4],print:6,prioriti:1,priority_flag:1,problem:7,process:7,prod:3,product:6,prometheu:6,prometheus_cli:6,properti:12,protocol:[0,1,3,5,6],protocol_id:1,provid:8,purchas:3,purpos:[0,6],put:[0,2,7],put_nowait:6,python3:6,python:[1,2,3,6,7,8,9],python_path:3,queu:[1,6,9],queue:[0,1,3,6,13],queue_nam:3,rabbitmq:[3,6,9],rais:1,rang:[1,6,11],rate:[1,3,5,10,13],ratelimit:[1,5,6],re_establish_conn_bind:1,reach:11,read:[1,6],readi:3,real:3,reason:[2,6,13],rebind:1,receipt:1,receipted_message_id:2,receiv:[1,4,9],receive_data:[1,3,6],recipi:1,recognis:8,reconnect:1,record:[6,7],redi:[3,6,9],registered_deliveri:1,regul:13,relat:[1,2,3],releas:6,reliabl:2,render:[6,7],replac:[1,3],replace_if_present_flag:1,repli:[6,13],repo:6,represenst:12,represent:9,requ:9,request:[1,4,6,10,11,13],requir:[1,6],respect:1,respond:13,respons:[1,3,4,6,11,13],ring:7,round:6,rout:[1,6],run:[1,3,6],run_until_complet:[1,3,6],sai:6,said:1,same:[],sample_s:[6,13],sampling_period:[6,13],san:6,satisfi:[0,2,3,4,6,10,11,13],save:[0,9],schedul:1,schedule_delivery_tim:1,scheme:8,sdk:6,second:[1,2,6,7,10,13],section:8,see:[3,4,8,11],self:[3,4,6,11,13],send:[1,3,4,6,9,10,13],send_data:[1,3],send_messag:3,send_messsag:10,send_rat:[6,10],send_request:3,sender:[1,9],sens:6,sent:[1,3,4,8,9],sentri:6,sentry_sdk:6,sequenc:[1,2,5],sequence_gener:1,sequence_numb:[1,2,11],sequence_number1:2,serial:[0,9],serv:1,server:[1,3,6,10],servic:[1,6],service_typ:1,session:[1,12],set:[3,6,7,8],setformatt:[6,7],setlevel:[6,7],setmessagestatehook:6,setup:6,sever:7,ship:[3,6,9],shoe:3,shop:9,short_messag:[1,3,6,9],should:[0,1,2,3,4,6,7,8,9,10,11,13],shouldflush:7,show:[3,6],shown:[0,2,4,10,11,13],shutdown:1,signal:1,signatur:[0,2,4,10,11,13],signifi:1,simpl:[2,6],simplebrok:[0,1,6],simplecodec:8,simplecorrelat:2,simplehook:[4,6],simplelogg:[6,7],simpleratelimit:[6,10],simplesequencegener:11,simplethrottlehandl:[6,13],simul:[3,6],singl:1,situat:8,size:0,sleep:3,slot:8,sm_default_msg_id:1,sme:1,smpp:[1,2,3,6,8,11,12,13],smpp_command:[1,2,3,4,6,9],smpp_server:3,smppclient1:[1,3,6],smppcommand:[6,9,12],smppcommandstatu:12,smppdatacod:12,smppoptionaltag:12,smppsessionst:12,smsc:[1,2,3,4,6,8,9,10,13],smsc_host:[1,3,6],smsc_message_id1:2,smsc_message_id:2,smsc_port:[1,3,6],smstabl:6,socket:1,socket_timeout:1,softwar:3,some:[1,9],sometim:6,sourc:[0,1,2,4,7,8,9,10,11,12,13],source_addr:[1,3,6,9],source_addr_npi:1,source_addr_ton:1,spec:8,specif:[1,8,11],specifi:[2,6,9,10],sql:6,sqlite3:6,stage:3,standard:8,standardconnectionhandl:3,start:[1,3,6,13],state:[1,3,4,5,6,8],statehook:6,statement:7,statu:[1,4,6,12,13],status:12,stderr:[],stdlib:7,stdout:7,stop:6,storag:2,store:[0,1,2,3,7,8],stored_at:2,str:[1,2,4,6,7,8,9],stream:7,streamhandl:[6,7],streamread:8,streamwrit:8,strict:8,string:[0,1,2,4,8,9],string_to_encod:[],structur:7,style:6,submit:[1,3],submit_sm:[1,2,3,4,6,9],submit_sm_resp:[2,3,4],success:3,suppli:[2,4,6],support:[1,6],suppos:6,surpass:6,system:1,system_id:[1,3,6],system_typ:1,tabl:6,tag:[2,12],take:[3,6],taken:7,talk:[3,6],target:7,targetlevel:7,task:[1,6],tell:7,termin:[1,6],test:[0,1,6],than:[6,13],thank:[3,9],thei:3,them:1,thi:[0,1,2,3,4,6,7,8,9,10,11,13],thing:3,third:6,those:6,throtll:[6,13],throttl:[1,3,5],throttle_delai:13,throttle_handl:[1,6],throttle_wait:13,throttler:6,through:3,thu:[6,13],time:[1,2,13],timeout:3,timestamp:3,tmp:[3,6],to_json:[0,3,9],to_smsc:[4,6],todo:1,token:[6,10],total:[6,13],track:[2,3,4],tracker:5,tracking_cod:3,tranceiver_bind:[1,6],transceiv:1,transfer:6,trigger:7,tupl:[2,8,12],tweet:7,two:6,type:[0,1,2,4,7,8,9,10,11,13],typic:3,ucs2:8,ultim:[],unbind:[1,6],unbind_resp:1,under:[6,13],union:[1,2,7,9],uniqu:[1,2,7,9],updat:6,upto:6,url:7,usag:[3,5,7,8,9,10],use:[0,2,3,6,7,9],used:[0,1,3,6,7,8,9],user:[0,1,2,4,10,11,13],uses:[1,2,6,8],using:[1,2,5,6,10],usual:[6,8],utf8:[],utf:[],valid:1,validity_period:1,valu:[2,6,7,12],variou:[1,3,12],version:[1,3,6,9],via:[1,6,13],wai:[3,6,13],wait:[1,3,13],want:[2,3,4,6],watch:6,web_request:7,wether:13,what:[1,3,6,9],whatev:[6,13],when:[1,3,4,6,7,11,13],whenev:6,where:[3,6],wherea:3,whether:[1,3,7],which:[1,3,6,7,8,10,11,12,13],who:3,wikipedia:6,work:[6,13],world:6,would:[1,6,9],wrap:[2,11],write:[1,6],www:7,you:[0,1,3,6,7,9,10],your:[3,6,9],your_sentry_project_id:6,your_sentry_public_kei:6,zero:8},titles:["broker","Client","correlater","Example demo of using naz","hooks","naz - naz is an async SMPP client.","Introduction to naz","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],titleterms:{api:5,app:6,async:[5,6],benchmark:6,broker:[0,6],bug:6,cli:6,client:[1,5],content:5,correlat:2,demo:3,everywher:6,exampl:3,featur:6,handl:6,hook:[4,6],instal:6,integr:6,introduct:6,librari:6,limit:6,log:[6,7],monitor:6,naz:[3,5,6],nazcodec:8,observ:6,protocol:9,rate:6,ratelimit:10,refer:5,sequenc:11,smpp:5,state:12,throttl:[6,13],tracker:6,usag:6,using:3}}) \ No newline at end of file diff --git a/docs/sequence.html b/docs/sequence.html index 8c1e28e4..251065ea 100644 --- a/docs/sequence.html +++ b/docs/sequence.html @@ -8,7 +8,7 @@ - sequence — naz v0.7.4 documentation + sequence — naz v0.7.5 documentation @@ -62,7 +62,7 @@
          - v0.7.4 + v0.7.5
          diff --git a/docs/state.html b/docs/state.html index d033c09e..7798054c 100644 --- a/docs/state.html +++ b/docs/state.html @@ -8,7 +8,7 @@ - state — naz v0.7.4 documentation + state — naz v0.7.5 documentation @@ -62,7 +62,7 @@
          - v0.7.4 + v0.7.5
          diff --git a/docs/throttle.html b/docs/throttle.html index 35f5cb78..ab0c2ec2 100644 --- a/docs/throttle.html +++ b/docs/throttle.html @@ -8,7 +8,7 @@ - throttle — naz v0.7.4 documentation + throttle — naz v0.7.5 documentation @@ -62,7 +62,7 @@
          - v0.7.4 + v0.7.5
          From afc37acba5955b6f44a3d0173fb1d518112e58a7 Mon Sep 17 00:00:00 2001 From: komuw Date: Tue, 3 Dec 2019 17:39:45 +0300 Subject: [PATCH 20/59] r --- docs/_modules/naz/nazcodec.html | 2 -- docs/searchindex.js | 2 +- naz/nazcodec.py | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/_modules/naz/nazcodec.html b/docs/_modules/naz/nazcodec.html index 9c051e57..ee05dc3e 100644 --- a/docs/_modules/naz/nazcodec.html +++ b/docs/_modules/naz/nazcodec.html @@ -377,7 +377,6 @@

          Source code for naz.nazcodec

                       encoder = self.custom_codecs[encoding].encode
                   else:
                       encoder = codecs.getencoder(encoding)
          -
                   return encoder(input, errors)
          [docs] def decode(self, input: bytes, errors: str = "strict") -> typing.Tuple[str, int]: @@ -388,7 +387,6 @@

          Source code for naz.nazcodec

                       decoder = self.custom_codecs[encoding].decode
                   else:
                       decoder = codecs.getdecoder(encoding)
          -
                   return decoder(input, errors)
          diff --git a/docs/searchindex.js b/docs/searchindex.js index 36bd007c..642b3db0 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["broker","client","correlater","example_demo","hooks","index","introduction","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["broker.rst","client.rst","correlater.rst","example_demo.rst","hooks.rst","index.rst","introduction.rst","log.rst","nazcodec.rst","protocol.rst","ratelimiter.rst","sequence.rst","state.rst","throttle.rst"],objects:{"naz.broker":{BaseBroker:[0,1,1,""],SimpleBroker:[0,1,1,""]},"naz.broker.BaseBroker":{dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.broker.SimpleBroker":{__init__:[0,2,1,""],dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.client":{Client:[1,1,1,""],NazClientError:[1,3,1,""]},"naz.client.Client":{__init__:[1,2,1,""],command_handlers:[1,2,1,""],connect:[1,2,1,""],deliver_sm_resp:[1,2,1,""],dequeue_messages:[1,2,1,""],enquire_link:[1,2,1,""],enquire_link_resp:[1,2,1,""],re_establish_conn_bind:[1,2,1,""],receive_data:[1,2,1,""],send_data:[1,2,1,""],shutdown:[1,2,1,""],submit_sm:[1,2,1,""],tranceiver_bind:[1,2,1,""],unbind:[1,2,1,""],unbind_resp:[1,2,1,""]},"naz.correlater":{BaseCorrelater:[2,1,1,""],SimpleCorrelater:[2,1,1,""]},"naz.correlater.BaseCorrelater":{get:[2,2,1,""],put:[2,2,1,""]},"naz.correlater.SimpleCorrelater":{__init__:[2,2,1,""],get:[2,2,1,""],put:[2,2,1,""]},"naz.hooks":{BaseHook:[4,1,1,""],SimpleHook:[4,1,1,""]},"naz.hooks.BaseHook":{from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.hooks.SimpleHook":{__init__:[4,2,1,""],from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.log":{BreachHandler:[7,1,1,""],SimpleLogger:[7,1,1,""]},"naz.log.BreachHandler":{__init__:[7,2,1,""],emit:[7,2,1,""],shouldFlush:[7,2,1,""]},"naz.log.SimpleLogger":{__init__:[7,2,1,""],log:[7,2,1,""]},"naz.nazcodec":{SimpleCodec:[8,1,1,""]},"naz.nazcodec.SimpleCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.protocol":{Message:[9,1,1,""]},"naz.protocol.Message":{__init__:[9,2,1,""],from_json:[9,2,1,""],to_json:[9,2,1,""]},"naz.ratelimiter":{BaseRateLimiter:[10,1,1,""],SimpleRateLimiter:[10,1,1,""]},"naz.ratelimiter.BaseRateLimiter":{limit:[10,2,1,""]},"naz.ratelimiter.SimpleRateLimiter":{__init__:[10,2,1,""],limit:[10,2,1,""]},"naz.sequence":{BaseSequenceGenerator:[11,1,1,""],SimpleSequenceGenerator:[11,1,1,""]},"naz.sequence.BaseSequenceGenerator":{next_sequence:[11,2,1,""]},"naz.sequence.SimpleSequenceGenerator":{__init__:[11,2,1,""],next_sequence:[11,2,1,""]},"naz.state":{CommandStatus:[12,1,1,""],DataCoding:[12,1,1,""],SmppCommand:[12,1,1,""],SmppCommandStatus:[12,1,1,""],SmppDataCoding:[12,1,1,""],SmppOptionalTag:[12,1,1,""],SmppSessionState:[12,1,1,""]},"naz.state.CommandStatus":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.state.DataCoding":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.throttle":{BaseThrottleHandler:[13,1,1,""],SimpleThrottleHandler:[13,1,1,""]},"naz.throttle.BaseThrottleHandler":{allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},"naz.throttle.SimpleThrottleHandler":{__init__:[13,2,1,""],allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},naz:{broker:[0,0,0,"-"],client:[1,0,0,"-"],correlater:[2,0,0,"-"],hooks:[4,0,0,"-"],log:[7,0,0,"-"],nazcodec:[8,0,0,"-"],protocol:[9,0,0,"-"],ratelimiter:[10,0,0,"-"],sequence:[11,0,0,"-"],state:[12,0,0,"-"],throttle:[13,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception"},terms:{"0r5nd6bsd3g4atwux":3,"16be":[],"20min":6,"2billion":2,"7wjf935mqgsjplq7e":3,"\u03c3cmt":3,"\u30c4":6,"abstract":[0,2,4,10,11,13],"byte":[1,4,8,9],"class":[0,1,2,3,4,6,7,8,9,10,11,12,13],"default":[6,7,8],"final":6,"float":[1,2,7,10,13],"function":1,"h\u00fclk":[],"import":[1,3,6,7,9,10,13],"int":[0,1,2,7,8,9,11],"long":[3,6,13],"return":[0,1,2,3,4,6,7,8,9,10,11,13],"short":[1,6],"static":9,"super":6,"true":[3,7],"try":6,"while":[1,3],"zo\u00e3":8,"zo\u00eb":8,AND:13,AWS:3,And:[3,6],But:3,For:[3,6],One:2,REs:6,SMS:1,SQS:3,SimpleCodec:[],That:[1,6],The:[0,1,2,3,6,8,9,11,13],Use:8,With:3,__init__:[0,1,2,3,4,6,7,8,9,10,11,13],_get_redi:3,_handler:7,_parse_response_pdu:1,_process_msg:6,_redi:3,abc:[0,2,4,10,11,13],abil:6,abl:[0,3,8,9],about:6,abov:[6,13],accept:3,acct:1,accur:[4,11],acknowledg:1,activ:[1,6],addhandl:[6,7],addit:1,addr_npi:1,addr_ton:1,address:[1,3],address_rang:1,after:[1,2,4,6,13],again:13,agnost:3,aha:7,aioredi:3,algorithm:[6,10],alia:12,all:[3,6,7],allow:[6,10,11],allow_request:13,alpin:3,also:[1,2,3,6,8,9,13],altern:7,among:2,ani:[1,2,3,4,6,9,13],annot:6,anoth:[2,3,6],anymor:13,anyth:6,api:6,app:[3,5],append:7,appli:[7,8],applic:[1,2,3,4,6,9],arg:[6,7],argument:[3,7],around:[2,11],arrang:1,articl:7,artist:6,associ:1,async:[0,1,2,3,4,10,13],asynchron:1,asyncio:[1,3,6],attach:7,authent:1,auto:2,avail:3,await:[3,6,10],awesom:3,awesomestor:3,b526gdnxfbf8sqlzz:3,backward:6,band:6,base:[0,1,2,4,7,8,9,10,11,12,13],basebrok:[0,1,3,6],basecorrelat:[1,2],basehook:[1,4,6],basenazcodec:[],baseratelimit:[1,6,10],basesequencegener:[1,11],basethrottlehandl:[1,6,13],basi:2,been:[1,3,7,8],befor:[1,3,4,6,7,13],benchmark:5,best:2,between:[1,2,6],bf_getreadbuf:8,bind:[1,6],bind_receiv:1,bind_transceiv:1,bind_transceiver_resp:1,bit:[7,8],block:1,bodi:1,body_data:1,bool:[1,7,13],both:3,breachhandl:7,bring:6,broker:[1,3,5,9],brpop:3,bucket:[6,10],buffer:[1,7,8],bug:5,busi:3,byte_str:[],calcul:13,call:[0,1,2,3,4,6,7,9,13],can:[0,1,3,6,7,8,9,10,12],capac:7,center:6,certain:7,chang:[3,6],charact:8,check:[1,6,7],child:[1,9],choic:[3,6],cleanli:1,cli:[3,5],client:[3,6,9,10,13],client_id:[1,3,6],close:[6,7],cmt:1,code:[1,3,9,12],codec:[1,8,9],codec_class:[1,9],com:7,come:2,command:[2,3,4,9,12],command_handl:[1,3],command_statu:3,command_status_valu:1,commandlin:6,commandstatu:[4,12],commit:6,commun:3,compos:6,condit:[7,13],config:6,confirm:3,conn:6,connect:[1,3,6],connection_lost:3,consult:[3,6],consum:[6,8],contain:[3,6],content:6,continu:[1,6],control:[1,6,10],correl:[2,4,9,11],correlat:5,correlatinid:6,correlation_handl:1,could:7,counter:6,creat:[3,6],create_redis_pool:3,cthank:3,current:[3,6,9],cursor:6,custom:[3,6,10],damn:7,data:[1,4,6,12],databas:6,datacod:12,debug:[6,7],decid:[6,7,13],decis:13,declar:[1,6],decod:[1,3,8,9],def:[3,6],defin:8,delet:2,deliv:6,deliver_sm:[2,6],deliver_sm_resp:1,deliveri:[1,2,6],demo:[0,5,6],demo_naz:3,deni:[6,13],deny_request_at:[6,13],depend:6,dequed_item:3,dequeu:[0,1,3,6],dequeue_messag:[1,3,6],deriv:6,descript:[6,12],deseri:9,design:[1,6],dest_addr_npi:1,dest_addr_ton:1,destin:1,destination_addr:[1,3,6,9],determin:13,develop:[3,6],diagnost:7,dict:[1,7],dictionari:2,did:7,differ:[1,2,4,9],directori:[3,6],doc:6,docker:[3,6],document:3,doe:[1,6,7,10,13],domain:1,done:[2,3],dot:[3,6],drain_dur:1,dry:3,durat:[1,13],each:6,effici:8,effort:2,elliot:7,els:[3,9],emit:7,emoji:6,empti:[3,8],enabl:[9,13],encod:[1,8,9,12],end:3,enqueu:[0,1,3,6],enquire_link:[1,6],enquire_link_interv:1,enquire_link_resp:1,entiti:6,environ:6,error:[1,6,7,8],errors_level:[],esm:[1,6],esm_class:1,esme_rmsgq:13,esme_rthrottl:6,etc:[3,7,9],even:[6,7],event:[3,6,7],everi:7,everytim:13,everywher:5,evolv:9,exampl:[1,5,6,7,8,10],example_config:6,examplebrok:6,exc_info:7,exce:13,exceed:7,except:[1,6,7],exclus:9,execut:[3,6],exist:1,exit:3,expect:3,expir:2,extern:6,fals:[1,3,7,13],featur:[2,5],field:[1,12],file:[3,6,7,8],flag:1,flow:1,flush:7,flushlevel:7,flushonclos:7,forc:3,format:[3,6,9],formatt:[6,7],found:6,from:[1,2,3,4,6,7,9,13],from_json:[0,3,9],from_smsc:[4,6],full:[1,4,9,13],futur:9,gatewai:[1,6],gather:[1,6],gener:[1,6,11],get:[1,2,3,6,9,13],get_event_loop:[1,3,6],getenv:1,getlogg:7,give:[3,6],given:[2,7],goe:13,going:[2,3],good:[6,7],googl:7,got:[7,13],greater:[6,13],gsm0338:8,gsm:8,guarante:2,had:[2,3,4],hand:1,handl:[3,5,8,13],handler:[1,6,7,13],happen:6,happili:3,has:[0,6,9],hasn:7,have:[3,6,7,8,13],heartbeat:7,heartbeatinterv:7,hello:[6,9],help:[3,4,11],here:6,higher:7,hip:6,hold:6,hook:[1,3,5,9],hook_metadata1:2,hook_metadata2:2,hook_metadata:[1,2,4,6,9],hop:6,host:[1,3,6],houston:7,how:[3,6,13],howev:[2,3],http:[6,7],ident:1,identifi:[1,2,9],ignor:[],implement:[0,1,2,3,4,6,7,8,10,11,13],implemet:1,implemnet:3,impos:13,inc:6,includ:[3,7],incompat:6,increas:11,increment:6,indic:[1,9],info:[6,7],inform:[6,7],inherit:[0,2,4,10,11,13],init:6,initi:[4,11],inject:6,input:8,insid:3,inspir:7,instal:[3,5],instanc:[0,1,3,6,8,9],instantait:3,instanti:[1,3],integ:[7,11],integr:5,interact:1,interfac:[0,2,3,4,6,10,11,13],interface_vers:1,introduct:5,issu:6,item:[0,1,2,3,6],its:[1,3],itself:13,jayz:7,join:6,json:[0,7,9],json_messag:9,just:[1,4,6,13],kafka:3,keep:[6,8],kei:[2,6,9],kenyan:6,keyword:7,klqk248jsk8:3,komuw:3,kvlog:6,kvlogger:6,kwarg:[6,7],last:13,later:[1,6,9],learn:3,least:7,leav:9,length:8,let:[3,6,10],level:[1,6,7],leverag:6,librari:5,like:[1,2,6,7,9],limit:[1,3,5,10,13],line:3,list:1,listen:[1,3],load:[6,13],localhost:3,log:[1,3,4,5,9],log_id1:2,log_id2:2,log_id:[1,2,3,4,6,9],log_metadata:[6,7],logger:[1,4,6,7,10,13],logger_nam:7,logic:3,look:[2,3,6],loop:[1,3,6],lost:1,lot:3,lpush:3,mai:[2,4,6,8,9,10,13],main:3,make:[1,3,6,8,13],mandat:2,manner:6,map:8,max_ttl:2,maximum:[0,7,10,11],maxsiz:[0,1,3,6],mean:[],mechan:[1,6],memori:[0,2,7,8],memoryhandl:7,messag:[0,1,2,3,4,6,7,8,9,10,13],met:7,metadata:[1,7],method:[0,1,2,4,6,8,9,10,11,13],metric:6,minimum:13,minsiz:3,minut:7,missi:7,mkdir:3,mode:1,monitor:5,monoton:11,more:[3,6,13],mostli:7,msg:[1,3,6,7,9],msisdn:[1,9],much:3,must:[0,2,4,8,10,11,13],mutual:9,my_app:6,my_brok:[3,6],my_client:3,my_config:6,my_naz_cli:[3,6],my_request:6,my_respons:6,myfil:6,myhook:6,myid12345:6,mylimit:6,mylogg:7,myprometheushook:6,myredisbrok:3,mysmsdb:6,mysteri:7,name:[1,6,7],naz:[0,1,2,4,7,8,9,10,11,12,13],naz_benchmarks_queu:3,nazclienterror:1,nazcodec:5,nazizi:6,ncodec:8,neccesari:0,need:[3,6],network:1,new_msg:6,next:3,next_sequ:11,none:[0,1,2,3,4,7,8,9,10,11,13],not_throttl:13,note:[0,2],notif:[2,6],notset:[],now:3,npi:1,number:[0,1,2,6,7,12,13],object:[1,8,9,12],observ:5,occur:6,ofcours:6,off:3,okai:3,omit:2,onc:3,one:[2,3,4,8,9],onli:[0,3,6,7,9],option:[2,3,12],order:[0,3,8],origin:1,other:[2,3,6],ought:11,our:3,out:[1,3,6],outgo:6,output:8,over:[1,6,13],own:[3,6],paramet:[0,1,2,4,6,7,8,9,10,12,13],pars:1,parti:6,particular:[2,3,13],pass:[1,3,6,7,9],password:[1,3,6],path:[3,6],pdu:[1,4,6,9],per:[6,7],percent:13,percentag:[6,13],period:[1,6],pid:3,pip:[3,6],place:[3,6],plan:1,port:[1,3],possibl:3,postgr:9,predefin:1,previous:[2,4],print:6,prioriti:1,priority_flag:1,problem:7,process:7,prod:3,product:6,prometheu:6,prometheus_cli:6,properti:12,protocol:[0,1,3,5,6],protocol_id:1,provid:8,purchas:3,purpos:[0,6],put:[0,2,7],put_nowait:6,python3:6,python:[1,2,3,6,7,8,9],python_path:3,queu:[1,6,9],queue:[0,1,3,6,13],queue_nam:3,rabbitmq:[3,6,9],rais:1,rang:[1,6,11],rate:[1,3,5,10,13],ratelimit:[1,5,6],re_establish_conn_bind:1,reach:11,read:[1,6],readi:3,real:3,reason:[2,6,13],rebind:1,receipt:1,receipted_message_id:2,receiv:[1,4,9],receive_data:[1,3,6],recipi:1,recognis:8,reconnect:1,record:[6,7],redi:[3,6,9],registered_deliveri:1,regul:13,relat:[1,2,3],releas:6,reliabl:2,render:[6,7],replac:[1,3],replace_if_present_flag:1,repli:[6,13],repo:6,represenst:12,represent:9,requ:9,request:[1,4,6,10,11,13],requir:[1,6],respect:1,respond:13,respons:[1,3,4,6,11,13],ring:7,round:6,rout:[1,6],run:[1,3,6],run_until_complet:[1,3,6],sai:6,said:1,same:[],sample_s:[6,13],sampling_period:[6,13],san:6,satisfi:[0,2,3,4,6,10,11,13],save:[0,9],schedul:1,schedule_delivery_tim:1,scheme:8,sdk:6,second:[1,2,6,7,10,13],section:8,see:[3,4,8,11],self:[3,4,6,11,13],send:[1,3,4,6,9,10,13],send_data:[1,3],send_messag:3,send_messsag:10,send_rat:[6,10],send_request:3,sender:[1,9],sens:6,sent:[1,3,4,8,9],sentri:6,sentry_sdk:6,sequenc:[1,2,5],sequence_gener:1,sequence_numb:[1,2,11],sequence_number1:2,serial:[0,9],serv:1,server:[1,3,6,10],servic:[1,6],service_typ:1,session:[1,12],set:[3,6,7,8],setformatt:[6,7],setlevel:[6,7],setmessagestatehook:6,setup:6,sever:7,ship:[3,6,9],shoe:3,shop:9,short_messag:[1,3,6,9],should:[0,1,2,3,4,6,7,8,9,10,11,13],shouldflush:7,show:[3,6],shown:[0,2,4,10,11,13],shutdown:1,signal:1,signatur:[0,2,4,10,11,13],signifi:1,simpl:[2,6],simplebrok:[0,1,6],simplecodec:8,simplecorrelat:2,simplehook:[4,6],simplelogg:[6,7],simpleratelimit:[6,10],simplesequencegener:11,simplethrottlehandl:[6,13],simul:[3,6],singl:1,situat:8,size:0,sleep:3,slot:8,sm_default_msg_id:1,sme:1,smpp:[1,2,3,6,8,11,12,13],smpp_command:[1,2,3,4,6,9],smpp_server:3,smppclient1:[1,3,6],smppcommand:[6,9,12],smppcommandstatu:12,smppdatacod:12,smppoptionaltag:12,smppsessionst:12,smsc:[1,2,3,4,6,8,9,10,13],smsc_host:[1,3,6],smsc_message_id1:2,smsc_message_id:2,smsc_port:[1,3,6],smstabl:6,socket:1,socket_timeout:1,softwar:3,some:[1,9],sometim:6,sourc:[0,1,2,4,7,8,9,10,11,12,13],source_addr:[1,3,6,9],source_addr_npi:1,source_addr_ton:1,spec:8,specif:[1,8,11],specifi:[2,6,9,10],sql:6,sqlite3:6,stage:3,standard:8,standardconnectionhandl:3,start:[1,3,6,13],state:[1,3,4,5,6,8],statehook:6,statement:7,statu:[1,4,6,12,13],status:12,stderr:[],stdlib:7,stdout:7,stop:6,storag:2,store:[0,1,2,3,7,8],stored_at:2,str:[1,2,4,6,7,8,9],stream:7,streamhandl:[6,7],streamread:8,streamwrit:8,strict:8,string:[0,1,2,4,8,9],string_to_encod:[],structur:7,style:6,submit:[1,3],submit_sm:[1,2,3,4,6,9],submit_sm_resp:[2,3,4],success:3,suppli:[2,4,6],support:[1,6],suppos:6,surpass:6,system:1,system_id:[1,3,6],system_typ:1,tabl:6,tag:[2,12],take:[3,6],taken:7,talk:[3,6],target:7,targetlevel:7,task:[1,6],tell:7,termin:[1,6],test:[0,1,6],than:[6,13],thank:[3,9],thei:3,them:1,thi:[0,1,2,3,4,6,7,8,9,10,11,13],thing:3,third:6,those:6,throtll:[6,13],throttl:[1,3,5],throttle_delai:13,throttle_handl:[1,6],throttle_wait:13,throttler:6,through:3,thu:[6,13],time:[1,2,13],timeout:3,timestamp:3,tmp:[3,6],to_json:[0,3,9],to_smsc:[4,6],todo:1,token:[6,10],total:[6,13],track:[2,3,4],tracker:5,tracking_cod:3,tranceiver_bind:[1,6],transceiv:1,transfer:6,trigger:7,tupl:[2,8,12],tweet:7,two:6,type:[0,1,2,4,7,8,9,10,11,13],typic:3,ucs2:8,ultim:[],unbind:[1,6],unbind_resp:1,under:[6,13],union:[1,2,7,9],uniqu:[1,2,7,9],updat:6,upto:6,url:7,usag:[3,5,7,8,9,10],use:[0,2,3,6,7,9],used:[0,1,3,6,7,8,9],user:[0,1,2,4,10,11,13],uses:[1,2,6,8],using:[1,2,5,6,10],usual:[6,8],utf8:[],utf:[],valid:1,validity_period:1,valu:[2,6,7,12],variou:[1,3,12],version:[1,3,6,9],via:[1,6,13],wai:[3,6,13],wait:[1,3,13],want:[2,3,4,6],watch:6,web_request:7,wether:13,what:[1,3,6,9],whatev:[6,13],when:[1,3,4,6,7,11,13],whenev:6,where:[3,6],wherea:3,whether:[1,3,7],which:[1,3,6,7,8,10,11,12,13],who:3,wikipedia:6,work:[6,13],world:6,would:[1,6,9],wrap:[2,11],write:[1,6],www:7,you:[0,1,3,6,7,9,10],your:[3,6,9],your_sentry_project_id:6,your_sentry_public_kei:6,zero:8},titles:["broker","Client","correlater","Example demo of using naz","hooks","naz - naz is an async SMPP client.","Introduction to naz","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],titleterms:{api:5,app:6,async:[5,6],benchmark:6,broker:[0,6],bug:6,cli:6,client:[1,5],content:5,correlat:2,demo:3,everywher:6,exampl:3,featur:6,handl:6,hook:[4,6],instal:6,integr:6,introduct:6,librari:6,limit:6,log:[6,7],monitor:6,naz:[3,5,6],nazcodec:8,observ:6,protocol:9,rate:6,ratelimit:10,refer:5,sequenc:11,smpp:5,state:12,throttl:[6,13],tracker:6,usag:6,using:3}}) \ No newline at end of file +Search.setIndex({docnames:["broker","client","correlater","example_demo","hooks","index","introduction","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["broker.rst","client.rst","correlater.rst","example_demo.rst","hooks.rst","index.rst","introduction.rst","log.rst","nazcodec.rst","protocol.rst","ratelimiter.rst","sequence.rst","state.rst","throttle.rst"],objects:{"naz.broker":{BaseBroker:[0,1,1,""],SimpleBroker:[0,1,1,""]},"naz.broker.BaseBroker":{dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.broker.SimpleBroker":{__init__:[0,2,1,""],dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.client":{Client:[1,1,1,""],NazClientError:[1,3,1,""]},"naz.client.Client":{__init__:[1,2,1,""],command_handlers:[1,2,1,""],connect:[1,2,1,""],deliver_sm_resp:[1,2,1,""],dequeue_messages:[1,2,1,""],enquire_link:[1,2,1,""],enquire_link_resp:[1,2,1,""],re_establish_conn_bind:[1,2,1,""],receive_data:[1,2,1,""],send_data:[1,2,1,""],shutdown:[1,2,1,""],submit_sm:[1,2,1,""],tranceiver_bind:[1,2,1,""],unbind:[1,2,1,""],unbind_resp:[1,2,1,""]},"naz.correlater":{BaseCorrelater:[2,1,1,""],SimpleCorrelater:[2,1,1,""]},"naz.correlater.BaseCorrelater":{get:[2,2,1,""],put:[2,2,1,""]},"naz.correlater.SimpleCorrelater":{__init__:[2,2,1,""],get:[2,2,1,""],put:[2,2,1,""]},"naz.hooks":{BaseHook:[4,1,1,""],SimpleHook:[4,1,1,""]},"naz.hooks.BaseHook":{from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.hooks.SimpleHook":{__init__:[4,2,1,""],from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.log":{BreachHandler:[7,1,1,""],SimpleLogger:[7,1,1,""]},"naz.log.BreachHandler":{__init__:[7,2,1,""],emit:[7,2,1,""],shouldFlush:[7,2,1,""]},"naz.log.SimpleLogger":{__init__:[7,2,1,""],log:[7,2,1,""]},"naz.nazcodec":{SimpleCodec:[8,1,1,""]},"naz.nazcodec.SimpleCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.protocol":{Message:[9,1,1,""]},"naz.protocol.Message":{__init__:[9,2,1,""],from_json:[9,2,1,""],to_json:[9,2,1,""]},"naz.ratelimiter":{BaseRateLimiter:[10,1,1,""],SimpleRateLimiter:[10,1,1,""]},"naz.ratelimiter.BaseRateLimiter":{limit:[10,2,1,""]},"naz.ratelimiter.SimpleRateLimiter":{__init__:[10,2,1,""],limit:[10,2,1,""]},"naz.sequence":{BaseSequenceGenerator:[11,1,1,""],SimpleSequenceGenerator:[11,1,1,""]},"naz.sequence.BaseSequenceGenerator":{next_sequence:[11,2,1,""]},"naz.sequence.SimpleSequenceGenerator":{__init__:[11,2,1,""],next_sequence:[11,2,1,""]},"naz.state":{CommandStatus:[12,1,1,""],DataCoding:[12,1,1,""],SmppCommand:[12,1,1,""],SmppCommandStatus:[12,1,1,""],SmppDataCoding:[12,1,1,""],SmppOptionalTag:[12,1,1,""],SmppSessionState:[12,1,1,""]},"naz.state.CommandStatus":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.state.DataCoding":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.throttle":{BaseThrottleHandler:[13,1,1,""],SimpleThrottleHandler:[13,1,1,""]},"naz.throttle.BaseThrottleHandler":{allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},"naz.throttle.SimpleThrottleHandler":{__init__:[13,2,1,""],allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},naz:{broker:[0,0,0,"-"],client:[1,0,0,"-"],correlater:[2,0,0,"-"],hooks:[4,0,0,"-"],log:[7,0,0,"-"],nazcodec:[8,0,0,"-"],protocol:[9,0,0,"-"],ratelimiter:[10,0,0,"-"],sequence:[11,0,0,"-"],state:[12,0,0,"-"],throttle:[13,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception"},terms:{"0r5nd6bsd3g4atwux":3,"16be":[],"20min":6,"2billion":2,"7wjf935mqgsjplq7e":3,"\u03c3cmt":3,"\u30c4":6,"abstract":[0,2,4,10,11,13],"byte":[1,4,8,9],"class":[0,1,2,3,4,6,7,8,9,10,11,12,13],"default":[6,7,8],"final":6,"float":[1,2,7,10,13],"function":1,"h\u00fclk":[],"import":[1,3,6,7,9,10,13],"int":[0,1,2,7,8,9,11],"long":[3,6,13],"return":[0,1,2,3,4,6,7,8,9,10,11,13],"short":[1,6],"static":9,"super":6,"true":[3,7],"try":6,"while":[1,3],"zo\u00e3":8,"zo\u00eb":8,AND:13,AWS:3,And:[3,6],But:3,For:[3,6],One:2,REs:6,SMS:1,SQS:3,SimpleCodec:[],That:[1,6],The:[0,1,2,3,6,8,9,11,13],Use:8,With:3,__init__:[0,1,2,3,4,6,7,8,9,10,11,13],_get_redi:3,_handler:7,_parse_response_pdu:1,_process_msg:6,_redi:3,abc:[0,2,4,10,11,13],abil:6,abl:[0,3,8,9],about:6,abov:[6,13],accept:3,acct:1,accur:[4,11],acknowledg:1,activ:[1,6],addhandl:[6,7],addit:1,addr_npi:1,addr_ton:1,address:[1,3],address_rang:1,after:[1,2,4,6,13],again:13,agnost:3,aha:7,aioredi:3,algorithm:[6,10],alia:12,all:[3,6,7],allow:[6,10,11],allow_request:13,alpin:3,also:[1,2,3,6,8,9,13],altern:7,among:2,ani:[1,2,3,4,6,9,13],annot:6,anoth:[2,3,6],anymor:13,anyth:6,api:6,app:[3,5],append:7,appli:[7,8],applic:[1,2,3,4,6,9],arg:[6,7],argument:[3,7],around:[2,11],arrang:1,articl:7,artist:6,associ:1,async:[0,1,2,3,4,10,13],asynchron:1,asyncio:[1,3,6],attach:7,authent:1,auto:2,avail:3,await:[3,6,10],awesom:3,awesomestor:3,b526gdnxfbf8sqlzz:3,backward:6,band:6,base:[0,1,2,4,7,8,9,10,11,12,13],basebrok:[0,1,3,6],basecorrelat:[1,2],basehook:[1,4,6],basenazcodec:[],baseratelimit:[1,6,10],basesequencegener:[1,11],basethrottlehandl:[1,6,13],basi:2,been:[1,3,7,8],befor:[1,3,4,6,7,13],benchmark:5,best:2,between:[1,2,6],bf_getreadbuf:8,bind:[1,6],bind_receiv:1,bind_transceiv:1,bind_transceiver_resp:1,bit:[7,8],block:1,bodi:1,body_data:1,bool:[1,7,13],both:3,breachhandl:7,bring:6,broker:[1,3,5,9],brpop:3,bucket:[6,10],buffer:[1,7,8],bug:5,busi:3,byte_str:[],calcul:13,call:[0,1,2,3,4,6,7,9,13],can:[0,1,3,6,7,8,9,10,12],capac:7,center:6,certain:7,chang:[3,6],charact:8,check:[1,6,7],child:[1,9],choic:[3,6],cleanli:1,cli:[3,5],client:[3,6,9,10,13],client_id:[1,3,6],close:[6,7],cmt:1,code:[1,3,9,12],codec:[1,8,9],codec_class:[1,9],com:7,come:2,command:[2,3,4,9,12],command_handl:[1,3],command_statu:3,command_status_valu:1,commandlin:6,commandstatu:[4,12],commit:6,commun:3,compos:6,condit:[7,13],config:6,confirm:3,conn:6,connect:[1,3,6],connection_lost:3,consult:[3,6],consum:[6,8],contain:[3,6],content:6,continu:[1,6],control:[1,6,10],correl:[2,4,9,11],correlat:5,correlatinid:6,correlation_handl:1,could:7,counter:6,creat:[3,6],create_redis_pool:3,cthank:3,current:[3,6,9],cursor:6,custom:[3,6,10],damn:7,data:[1,4,6,12],databas:6,datacod:12,debug:[6,7],decid:[6,7,13],decis:13,declar:[1,6],decod:[1,3,8,9],def:[3,6],defin:8,delet:2,deliv:6,deliver_sm:[2,6],deliver_sm_resp:1,deliveri:[1,2,6],demo:[0,5,6],demo_naz:3,deni:[6,13],deny_request_at:[6,13],depend:6,dequed_item:3,dequeu:[0,1,3,6],dequeue_messag:[1,3,6],deriv:6,descript:[6,12],deseri:9,design:[1,6],dest_addr_npi:1,dest_addr_ton:1,destin:1,destination_addr:[1,3,6,9],determin:13,develop:[3,6],diagnost:7,dict:[1,7],dictionari:2,did:7,differ:[1,2,4,9],directori:[3,6],doc:6,docker:[3,6],document:3,doe:[1,6,7,10,13],domain:1,done:[2,3],dot:[3,6],drain_dur:1,dry:3,durat:[1,13],each:6,easy_decod:[],easy_encod:[],effici:8,effort:2,elliot:7,els:[3,9],emit:7,emoji:6,empti:[3,8],enabl:[9,13],encod:[1,8,9,12],end:3,enqueu:[0,1,3,6],enquire_link:[1,6],enquire_link_interv:1,enquire_link_resp:1,entiti:6,environ:6,error:[1,6,7,8],errors_level:[],esm:[1,6],esm_class:1,esme_rmsgq:13,esme_rthrottl:6,etc:[3,7,9],even:[6,7],event:[3,6,7],everi:7,everytim:13,everywher:5,evolv:9,exampl:[1,5,6,7,8,10],example_config:6,examplebrok:6,exc_info:7,exce:13,exceed:7,except:[1,6,7],exclus:9,execut:[3,6],exist:1,exit:3,expect:3,expir:2,extern:6,fals:[1,3,7,13],featur:[2,5],field:[1,12],file:[3,6,7,8],flag:1,flow:1,flush:7,flushlevel:7,flushonclos:7,forc:3,format:[3,6,9],formatt:[6,7],found:6,from:[1,2,3,4,6,7,9,13],from_json:[0,3,9],from_smsc:[4,6],full:[1,4,9,13],futur:9,gatewai:[1,6],gather:[1,6],gener:[1,6,11],get:[1,2,3,6,9,13],get_event_loop:[1,3,6],getenv:1,getlogg:7,give:[3,6],given:[2,7],goe:13,going:[2,3],good:[6,7],googl:7,got:[7,13],greater:[6,13],gsm0338:8,gsm:8,guarante:2,had:[2,3,4],hand:1,handl:[3,5,8,13],handler:[1,6,7,13],happen:6,happili:3,has:[0,6,9],hasn:7,have:[3,6,7,8,13],heartbeat:7,heartbeatinterv:7,hello:[6,9],help:[3,4,11],here:6,higher:7,hip:6,hold:6,hook:[1,3,5,9],hook_metadata1:2,hook_metadata2:2,hook_metadata:[1,2,4,6,9],hop:6,host:[1,3,6],houston:7,how:[3,6,13],howev:[2,3],http:[6,7],ident:1,identifi:[1,2,9],ignor:[],implement:[0,1,2,3,4,6,7,8,10,11,13],implemet:1,implemnet:3,impos:13,inc:6,includ:[3,7],incompat:6,increas:11,increment:6,indic:[1,9],info:[6,7],inform:[6,7],inherit:[0,2,4,10,11,13],init:6,initi:[4,11],inject:6,input:8,insid:3,inspir:7,instal:[3,5],instanc:[0,1,3,6,8,9],instantait:3,instanti:[1,3],integ:[7,11],integr:5,interact:1,interfac:[0,2,3,4,6,10,11,13],interface_vers:1,introduct:5,issu:6,item:[0,1,2,3,6],its:[1,3],itself:13,jayz:7,join:6,json:[0,7,9],json_messag:9,just:[1,4,6,13],kafka:3,keep:[6,8],kei:[2,6,9],kenyan:6,keyword:7,klqk248jsk8:3,komuw:3,kvlog:6,kvlogger:6,kwarg:[6,7],last:13,later:[1,6,9],learn:3,least:7,leav:9,length:8,let:[3,6,10],level:[1,6,7],leverag:6,librari:5,like:[1,2,6,7,9],limit:[1,3,5,10,13],line:3,list:1,listen:[1,3],load:[6,13],localhost:3,log:[1,3,4,5,9],log_id1:2,log_id2:2,log_id:[1,2,3,4,6,9],log_metadata:[6,7],logger:[1,4,6,7,10,13],logger_nam:7,logic:3,look:[2,3,6],loop:[1,3,6],lost:1,lot:3,lpush:3,mai:[2,4,6,8,9,10,13],main:3,make:[1,3,6,8,13],mandat:2,manner:6,map:8,max_ttl:2,maximum:[0,7,10,11],maxsiz:[0,1,3,6],mean:[],mechan:[1,6],memori:[0,2,7,8],memoryhandl:7,messag:[0,1,2,3,4,6,7,8,9,10,13],met:7,metadata:[1,7],method:[0,1,2,4,6,8,9,10,11,13],metric:6,minimum:13,minsiz:3,minut:7,missi:7,mkdir:3,mode:1,monitor:5,monoton:11,more:[3,6,13],mostli:7,msg:[1,3,6,7,9],msisdn:[1,9],much:3,must:[0,2,4,8,10,11,13],mutual:9,my_app:6,my_brok:[3,6],my_client:3,my_config:6,my_naz_cli:[3,6],my_request:6,my_respons:6,myfil:6,myhook:6,myid12345:6,mylimit:6,mylogg:7,myprometheushook:6,myredisbrok:3,mysmsdb:6,mysteri:7,name:[1,6,7],naz:[0,1,2,4,7,8,9,10,11,12,13],naz_benchmarks_queu:3,nazclienterror:1,nazcodec:5,nazizi:6,ncodec:8,neccesari:0,need:[3,6],network:1,new_msg:6,next:3,next_sequ:11,none:[0,1,2,3,4,7,8,9,10,11,13],not_throttl:13,note:[0,2],notif:[2,6],notset:[],now:3,npi:1,number:[0,1,2,6,7,12,13],object:[1,8,9,12],observ:5,occur:6,ofcours:6,off:3,okai:3,omit:2,onc:3,one:[2,3,4,8,9],onli:[0,3,6,7,9],option:[2,3,12],order:[0,3,8],origin:1,other:[2,3,6],ought:11,our:3,out:[1,3,6],outgo:6,output:8,over:[1,6,13],own:[3,6],paramet:[0,1,2,4,6,7,8,9,10,12,13],pars:1,parti:6,particular:[2,3,13],pass:[1,3,6,7,9],password:[1,3,6],path:[3,6],pdu:[1,4,6,9],per:[6,7],percent:13,percentag:[6,13],period:[1,6],pid:3,pip:[3,6],place:[3,6],plan:1,port:[1,3],possibl:3,postgr:9,predefin:1,previous:[2,4],print:6,prioriti:1,priority_flag:1,problem:7,process:7,prod:3,product:6,prometheu:6,prometheus_cli:6,properti:12,protocol:[0,1,3,5,6],protocol_id:1,provid:8,purchas:3,purpos:[0,6],put:[0,2,7],put_nowait:6,python3:6,python:[1,2,3,6,7,8,9],python_path:3,queu:[1,6,9],queue:[0,1,3,6,13],queue_nam:3,rabbitmq:[3,6,9],rais:1,rang:[1,6,11],rate:[1,3,5,10,13],ratelimit:[1,5,6],re_establish_conn_bind:1,reach:11,read:[1,6],readi:3,real:3,reason:[2,6,13],rebind:1,receipt:1,receipted_message_id:2,receiv:[1,4,9],receive_data:[1,3,6],recipi:1,recognis:8,reconnect:1,record:[6,7],redi:[3,6,9],registered_deliveri:1,regul:13,relat:[1,2,3],releas:6,reliabl:2,render:[6,7],replac:[1,3],replace_if_present_flag:1,repli:[6,13],repo:6,represenst:12,represent:9,requ:9,request:[1,4,6,10,11,13],requir:[1,6],respect:1,respond:13,respons:[1,3,4,6,11,13],ring:7,round:6,rout:[1,6],run:[1,3,6],run_until_complet:[1,3,6],sai:6,said:1,same:[],sample_s:[6,13],sampling_period:[6,13],san:6,satisfi:[0,2,3,4,6,10,11,13],save:[0,9],schedul:1,schedule_delivery_tim:1,scheme:8,sdk:6,second:[1,2,6,7,10,13],section:8,see:[3,4,8,11],self:[3,4,6,11,13],send:[1,3,4,6,9,10,13],send_data:[1,3],send_messag:3,send_messsag:10,send_rat:[6,10],send_request:3,sender:[1,9],sens:6,sent:[1,3,4,8,9],sentri:6,sentry_sdk:6,sequenc:[1,2,5],sequence_gener:1,sequence_numb:[1,2,11],sequence_number1:2,serial:[0,9],serv:1,server:[1,3,6,10],servic:[1,6],service_typ:1,session:[1,12],set:[3,6,7,8],setformatt:[6,7],setlevel:[6,7],setmessagestatehook:6,setup:6,sever:7,ship:[3,6,9],shoe:3,shop:9,short_messag:[1,3,6,9],should:[0,1,2,3,4,6,7,8,9,10,11,13],shouldflush:7,show:[3,6],shown:[0,2,4,10,11,13],shutdown:1,signal:1,signatur:[0,2,4,10,11,13],signifi:1,simpl:[2,6],simplebrok:[0,1,6],simplecodec:8,simplecorrelat:2,simplehook:[4,6],simplelogg:[6,7],simpler:[],simpleratelimit:[6,10],simplesequencegener:11,simplethrottlehandl:[6,13],simul:[3,6],singl:1,situat:8,size:0,sleep:3,slot:8,sm_default_msg_id:1,sme:1,smpp:[1,2,3,6,8,11,12,13],smpp_command:[1,2,3,4,6,9],smpp_server:3,smppclient1:[1,3,6],smppcommand:[6,9,12],smppcommandstatu:12,smppdatacod:12,smppoptionaltag:12,smppsessionst:12,smsc:[1,2,3,4,6,8,9,10,13],smsc_host:[1,3,6],smsc_message_id1:2,smsc_message_id:2,smsc_port:[1,3,6],smstabl:6,socket:1,socket_timeout:1,softwar:3,some:[1,9],sometim:6,sourc:[0,1,2,4,7,8,9,10,11,12,13],source_addr:[1,3,6,9],source_addr_npi:1,source_addr_ton:1,spec:8,specif:[1,8,11],specifi:[2,6,9,10],sql:6,sqlite3:6,stage:3,standard:8,standardconnectionhandl:3,start:[1,3,6,13],state:[1,3,4,5,6,8],statehook:6,statement:7,statu:[1,4,6,12,13],status:12,stderr:[],stdlib:7,stdout:7,stop:6,storag:2,store:[0,1,2,3,7,8],stored_at:2,str:[1,2,4,6,7,8,9],stream:7,streamhandl:[6,7],streamread:8,streamwrit:8,strict:8,string:[0,1,2,4,8,9],string_to_encod:[],structur:7,style:6,submit:[1,3],submit_sm:[1,2,3,4,6,9],submit_sm_resp:[2,3,4],success:3,suppli:[2,4,6],support:[1,6],suppos:6,surpass:6,system:1,system_id:[1,3,6],system_typ:1,tabl:6,tag:[2,12],take:[3,6],taken:7,talk:[3,6],target:7,targetlevel:7,task:[1,6],tell:7,termin:[1,6],test:[0,1,6],than:[6,13],thank:[3,9],thei:3,them:1,thi:[0,1,2,3,4,6,7,8,9,10,11,13],thing:3,third:6,those:6,throtll:[6,13],throttl:[1,3,5],throttle_delai:13,throttle_handl:[1,6],throttle_wait:13,throttler:6,through:3,thu:[6,13],time:[1,2,13],timeout:3,timestamp:3,tmp:[3,6],to_json:[0,3,9],to_smsc:[4,6],todo:1,token:[6,10],total:[6,13],track:[2,3,4],tracker:5,tracking_cod:3,tranceiver_bind:[1,6],transceiv:1,transfer:6,trigger:7,tupl:[2,8,12],tweet:7,two:6,type:[0,1,2,4,7,8,9,10,11,13],typic:3,ucs2:8,ultim:[],unbind:[1,6],unbind_resp:1,under:[6,13],union:[1,2,7,9],uniqu:[1,2,7,9],updat:6,upto:6,url:7,usag:[3,5,7,8,9,10],use:[0,2,3,6,7,9],used:[0,1,3,6,7,8,9],user:[0,1,2,4,10,11,13],uses:[1,2,6,8],using:[1,2,5,6,10],usual:[6,8],utf8:[],utf:[],valid:1,validity_period:1,valu:[2,6,7,12],variou:[1,3,12],version:[1,3,6,9],via:[1,6,13],wai:[3,6,13],wait:[1,3,13],want:[2,3,4,6],watch:6,web_request:7,wether:13,what:[1,3,6,9],whatev:[6,13],when:[1,3,4,6,7,11,13],whenev:6,where:[3,6],wherea:3,whether:[1,3,7],which:[1,3,6,7,8,10,11,12,13],who:3,wikipedia:6,work:[6,13],world:6,would:[1,6,9],wrap:[2,11],wrapper:[],write:[1,6],www:7,you:[0,1,3,6,7,9,10],your:[3,6,9],your_sentry_project_id:6,your_sentry_public_kei:6,zero:8},titles:["broker","Client","correlater","Example demo of using naz","hooks","naz - naz is an async SMPP client.","Introduction to naz","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],titleterms:{api:5,app:6,async:[5,6],benchmark:6,broker:[0,6],bug:6,cli:6,client:[1,5],content:5,correlat:2,demo:3,everywher:6,exampl:3,featur:6,handl:6,hook:[4,6],instal:6,integr:6,introduct:6,librari:6,limit:6,log:[6,7],monitor:6,naz:[3,5,6],nazcodec:8,observ:6,protocol:9,rate:6,ratelimit:10,refer:5,sequenc:11,smpp:5,state:12,throttl:[6,13],tracker:6,usag:6,using:3}}) \ No newline at end of file diff --git a/naz/nazcodec.py b/naz/nazcodec.py index 5f442995..6a39db63 100644 --- a/naz/nazcodec.py +++ b/naz/nazcodec.py @@ -212,7 +212,6 @@ def encode(self, input: str, errors: str = "strict") -> typing.Tuple[bytes, int] encoder = self.custom_codecs[encoding].encode else: encoder = codecs.getencoder(encoding) - return encoder(input, errors) def decode(self, input: bytes, errors: str = "strict") -> typing.Tuple[str, int]: @@ -223,5 +222,4 @@ def decode(self, input: bytes, errors: str = "strict") -> typing.Tuple[str, int] decoder = self.custom_codecs[encoding].decode else: decoder = codecs.getdecoder(encoding) - return decoder(input, errors) From 12912b58760f8519a46e96037dfdd88b061c72c7 Mon Sep 17 00:00:00 2001 From: komuw Date: Wed, 4 Dec 2019 16:00:22 +0300 Subject: [PATCH 21/59] r --- docs/_sources/index.rst.txt | 2 +- docs/_sources/nazcodec.rst.txt | 4 +- docs/searchindex.js | 2 +- documentation/sphinx-docs/index.rst | 2 +- documentation/sphinx-docs/nazcodec.rst | 4 +- examples/example_config.py | 2 +- naz/__init__.py | 2 +- naz/client.py | 7 +++- naz/{nazcodec.py => codec.py} | 0 tests/test_cli.py | 2 +- tests/test_client.py | 4 +- tests/{test_nazcodec.py => test_codec.py} | 46 +++++++++++------------ tests/test_protocol.py | 4 +- 13 files changed, 42 insertions(+), 39 deletions(-) rename naz/{nazcodec.py => codec.py} (100%) rename tests/{test_nazcodec.py => test_codec.py} (69%) diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt index 046506da..c1bb9f6d 100644 --- a/docs/_sources/index.rst.txt +++ b/docs/_sources/index.rst.txt @@ -19,7 +19,7 @@ API reference protocol correlater hooks - nazcodec + codec broker ratelimiter sequence diff --git a/docs/_sources/nazcodec.rst.txt b/docs/_sources/nazcodec.rst.txt index b1173fae..42396dfc 100644 --- a/docs/_sources/nazcodec.rst.txt +++ b/docs/_sources/nazcodec.rst.txt @@ -1,7 +1,7 @@ -nazcodec +codec --------------- -.. automodule:: naz.nazcodec +.. automodule:: naz.codec :members: SimpleCodec :show-inheritance: diff --git a/docs/searchindex.js b/docs/searchindex.js index 642b3db0..adeef3fc 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["broker","client","correlater","example_demo","hooks","index","introduction","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["broker.rst","client.rst","correlater.rst","example_demo.rst","hooks.rst","index.rst","introduction.rst","log.rst","nazcodec.rst","protocol.rst","ratelimiter.rst","sequence.rst","state.rst","throttle.rst"],objects:{"naz.broker":{BaseBroker:[0,1,1,""],SimpleBroker:[0,1,1,""]},"naz.broker.BaseBroker":{dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.broker.SimpleBroker":{__init__:[0,2,1,""],dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.client":{Client:[1,1,1,""],NazClientError:[1,3,1,""]},"naz.client.Client":{__init__:[1,2,1,""],command_handlers:[1,2,1,""],connect:[1,2,1,""],deliver_sm_resp:[1,2,1,""],dequeue_messages:[1,2,1,""],enquire_link:[1,2,1,""],enquire_link_resp:[1,2,1,""],re_establish_conn_bind:[1,2,1,""],receive_data:[1,2,1,""],send_data:[1,2,1,""],shutdown:[1,2,1,""],submit_sm:[1,2,1,""],tranceiver_bind:[1,2,1,""],unbind:[1,2,1,""],unbind_resp:[1,2,1,""]},"naz.correlater":{BaseCorrelater:[2,1,1,""],SimpleCorrelater:[2,1,1,""]},"naz.correlater.BaseCorrelater":{get:[2,2,1,""],put:[2,2,1,""]},"naz.correlater.SimpleCorrelater":{__init__:[2,2,1,""],get:[2,2,1,""],put:[2,2,1,""]},"naz.hooks":{BaseHook:[4,1,1,""],SimpleHook:[4,1,1,""]},"naz.hooks.BaseHook":{from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.hooks.SimpleHook":{__init__:[4,2,1,""],from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.log":{BreachHandler:[7,1,1,""],SimpleLogger:[7,1,1,""]},"naz.log.BreachHandler":{__init__:[7,2,1,""],emit:[7,2,1,""],shouldFlush:[7,2,1,""]},"naz.log.SimpleLogger":{__init__:[7,2,1,""],log:[7,2,1,""]},"naz.nazcodec":{SimpleCodec:[8,1,1,""]},"naz.nazcodec.SimpleCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.protocol":{Message:[9,1,1,""]},"naz.protocol.Message":{__init__:[9,2,1,""],from_json:[9,2,1,""],to_json:[9,2,1,""]},"naz.ratelimiter":{BaseRateLimiter:[10,1,1,""],SimpleRateLimiter:[10,1,1,""]},"naz.ratelimiter.BaseRateLimiter":{limit:[10,2,1,""]},"naz.ratelimiter.SimpleRateLimiter":{__init__:[10,2,1,""],limit:[10,2,1,""]},"naz.sequence":{BaseSequenceGenerator:[11,1,1,""],SimpleSequenceGenerator:[11,1,1,""]},"naz.sequence.BaseSequenceGenerator":{next_sequence:[11,2,1,""]},"naz.sequence.SimpleSequenceGenerator":{__init__:[11,2,1,""],next_sequence:[11,2,1,""]},"naz.state":{CommandStatus:[12,1,1,""],DataCoding:[12,1,1,""],SmppCommand:[12,1,1,""],SmppCommandStatus:[12,1,1,""],SmppDataCoding:[12,1,1,""],SmppOptionalTag:[12,1,1,""],SmppSessionState:[12,1,1,""]},"naz.state.CommandStatus":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.state.DataCoding":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.throttle":{BaseThrottleHandler:[13,1,1,""],SimpleThrottleHandler:[13,1,1,""]},"naz.throttle.BaseThrottleHandler":{allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},"naz.throttle.SimpleThrottleHandler":{__init__:[13,2,1,""],allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},naz:{broker:[0,0,0,"-"],client:[1,0,0,"-"],correlater:[2,0,0,"-"],hooks:[4,0,0,"-"],log:[7,0,0,"-"],nazcodec:[8,0,0,"-"],protocol:[9,0,0,"-"],ratelimiter:[10,0,0,"-"],sequence:[11,0,0,"-"],state:[12,0,0,"-"],throttle:[13,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception"},terms:{"0r5nd6bsd3g4atwux":3,"16be":[],"20min":6,"2billion":2,"7wjf935mqgsjplq7e":3,"\u03c3cmt":3,"\u30c4":6,"abstract":[0,2,4,10,11,13],"byte":[1,4,8,9],"class":[0,1,2,3,4,6,7,8,9,10,11,12,13],"default":[6,7,8],"final":6,"float":[1,2,7,10,13],"function":1,"h\u00fclk":[],"import":[1,3,6,7,9,10,13],"int":[0,1,2,7,8,9,11],"long":[3,6,13],"return":[0,1,2,3,4,6,7,8,9,10,11,13],"short":[1,6],"static":9,"super":6,"true":[3,7],"try":6,"while":[1,3],"zo\u00e3":8,"zo\u00eb":8,AND:13,AWS:3,And:[3,6],But:3,For:[3,6],One:2,REs:6,SMS:1,SQS:3,SimpleCodec:[],That:[1,6],The:[0,1,2,3,6,8,9,11,13],Use:8,With:3,__init__:[0,1,2,3,4,6,7,8,9,10,11,13],_get_redi:3,_handler:7,_parse_response_pdu:1,_process_msg:6,_redi:3,abc:[0,2,4,10,11,13],abil:6,abl:[0,3,8,9],about:6,abov:[6,13],accept:3,acct:1,accur:[4,11],acknowledg:1,activ:[1,6],addhandl:[6,7],addit:1,addr_npi:1,addr_ton:1,address:[1,3],address_rang:1,after:[1,2,4,6,13],again:13,agnost:3,aha:7,aioredi:3,algorithm:[6,10],alia:12,all:[3,6,7],allow:[6,10,11],allow_request:13,alpin:3,also:[1,2,3,6,8,9,13],altern:7,among:2,ani:[1,2,3,4,6,9,13],annot:6,anoth:[2,3,6],anymor:13,anyth:6,api:6,app:[3,5],append:7,appli:[7,8],applic:[1,2,3,4,6,9],arg:[6,7],argument:[3,7],around:[2,11],arrang:1,articl:7,artist:6,associ:1,async:[0,1,2,3,4,10,13],asynchron:1,asyncio:[1,3,6],attach:7,authent:1,auto:2,avail:3,await:[3,6,10],awesom:3,awesomestor:3,b526gdnxfbf8sqlzz:3,backward:6,band:6,base:[0,1,2,4,7,8,9,10,11,12,13],basebrok:[0,1,3,6],basecorrelat:[1,2],basehook:[1,4,6],basenazcodec:[],baseratelimit:[1,6,10],basesequencegener:[1,11],basethrottlehandl:[1,6,13],basi:2,been:[1,3,7,8],befor:[1,3,4,6,7,13],benchmark:5,best:2,between:[1,2,6],bf_getreadbuf:8,bind:[1,6],bind_receiv:1,bind_transceiv:1,bind_transceiver_resp:1,bit:[7,8],block:1,bodi:1,body_data:1,bool:[1,7,13],both:3,breachhandl:7,bring:6,broker:[1,3,5,9],brpop:3,bucket:[6,10],buffer:[1,7,8],bug:5,busi:3,byte_str:[],calcul:13,call:[0,1,2,3,4,6,7,9,13],can:[0,1,3,6,7,8,9,10,12],capac:7,center:6,certain:7,chang:[3,6],charact:8,check:[1,6,7],child:[1,9],choic:[3,6],cleanli:1,cli:[3,5],client:[3,6,9,10,13],client_id:[1,3,6],close:[6,7],cmt:1,code:[1,3,9,12],codec:[1,8,9],codec_class:[1,9],com:7,come:2,command:[2,3,4,9,12],command_handl:[1,3],command_statu:3,command_status_valu:1,commandlin:6,commandstatu:[4,12],commit:6,commun:3,compos:6,condit:[7,13],config:6,confirm:3,conn:6,connect:[1,3,6],connection_lost:3,consult:[3,6],consum:[6,8],contain:[3,6],content:6,continu:[1,6],control:[1,6,10],correl:[2,4,9,11],correlat:5,correlatinid:6,correlation_handl:1,could:7,counter:6,creat:[3,6],create_redis_pool:3,cthank:3,current:[3,6,9],cursor:6,custom:[3,6,10],damn:7,data:[1,4,6,12],databas:6,datacod:12,debug:[6,7],decid:[6,7,13],decis:13,declar:[1,6],decod:[1,3,8,9],def:[3,6],defin:8,delet:2,deliv:6,deliver_sm:[2,6],deliver_sm_resp:1,deliveri:[1,2,6],demo:[0,5,6],demo_naz:3,deni:[6,13],deny_request_at:[6,13],depend:6,dequed_item:3,dequeu:[0,1,3,6],dequeue_messag:[1,3,6],deriv:6,descript:[6,12],deseri:9,design:[1,6],dest_addr_npi:1,dest_addr_ton:1,destin:1,destination_addr:[1,3,6,9],determin:13,develop:[3,6],diagnost:7,dict:[1,7],dictionari:2,did:7,differ:[1,2,4,9],directori:[3,6],doc:6,docker:[3,6],document:3,doe:[1,6,7,10,13],domain:1,done:[2,3],dot:[3,6],drain_dur:1,dry:3,durat:[1,13],each:6,easy_decod:[],easy_encod:[],effici:8,effort:2,elliot:7,els:[3,9],emit:7,emoji:6,empti:[3,8],enabl:[9,13],encod:[1,8,9,12],end:3,enqueu:[0,1,3,6],enquire_link:[1,6],enquire_link_interv:1,enquire_link_resp:1,entiti:6,environ:6,error:[1,6,7,8],errors_level:[],esm:[1,6],esm_class:1,esme_rmsgq:13,esme_rthrottl:6,etc:[3,7,9],even:[6,7],event:[3,6,7],everi:7,everytim:13,everywher:5,evolv:9,exampl:[1,5,6,7,8,10],example_config:6,examplebrok:6,exc_info:7,exce:13,exceed:7,except:[1,6,7],exclus:9,execut:[3,6],exist:1,exit:3,expect:3,expir:2,extern:6,fals:[1,3,7,13],featur:[2,5],field:[1,12],file:[3,6,7,8],flag:1,flow:1,flush:7,flushlevel:7,flushonclos:7,forc:3,format:[3,6,9],formatt:[6,7],found:6,from:[1,2,3,4,6,7,9,13],from_json:[0,3,9],from_smsc:[4,6],full:[1,4,9,13],futur:9,gatewai:[1,6],gather:[1,6],gener:[1,6,11],get:[1,2,3,6,9,13],get_event_loop:[1,3,6],getenv:1,getlogg:7,give:[3,6],given:[2,7],goe:13,going:[2,3],good:[6,7],googl:7,got:[7,13],greater:[6,13],gsm0338:8,gsm:8,guarante:2,had:[2,3,4],hand:1,handl:[3,5,8,13],handler:[1,6,7,13],happen:6,happili:3,has:[0,6,9],hasn:7,have:[3,6,7,8,13],heartbeat:7,heartbeatinterv:7,hello:[6,9],help:[3,4,11],here:6,higher:7,hip:6,hold:6,hook:[1,3,5,9],hook_metadata1:2,hook_metadata2:2,hook_metadata:[1,2,4,6,9],hop:6,host:[1,3,6],houston:7,how:[3,6,13],howev:[2,3],http:[6,7],ident:1,identifi:[1,2,9],ignor:[],implement:[0,1,2,3,4,6,7,8,10,11,13],implemet:1,implemnet:3,impos:13,inc:6,includ:[3,7],incompat:6,increas:11,increment:6,indic:[1,9],info:[6,7],inform:[6,7],inherit:[0,2,4,10,11,13],init:6,initi:[4,11],inject:6,input:8,insid:3,inspir:7,instal:[3,5],instanc:[0,1,3,6,8,9],instantait:3,instanti:[1,3],integ:[7,11],integr:5,interact:1,interfac:[0,2,3,4,6,10,11,13],interface_vers:1,introduct:5,issu:6,item:[0,1,2,3,6],its:[1,3],itself:13,jayz:7,join:6,json:[0,7,9],json_messag:9,just:[1,4,6,13],kafka:3,keep:[6,8],kei:[2,6,9],kenyan:6,keyword:7,klqk248jsk8:3,komuw:3,kvlog:6,kvlogger:6,kwarg:[6,7],last:13,later:[1,6,9],learn:3,least:7,leav:9,length:8,let:[3,6,10],level:[1,6,7],leverag:6,librari:5,like:[1,2,6,7,9],limit:[1,3,5,10,13],line:3,list:1,listen:[1,3],load:[6,13],localhost:3,log:[1,3,4,5,9],log_id1:2,log_id2:2,log_id:[1,2,3,4,6,9],log_metadata:[6,7],logger:[1,4,6,7,10,13],logger_nam:7,logic:3,look:[2,3,6],loop:[1,3,6],lost:1,lot:3,lpush:3,mai:[2,4,6,8,9,10,13],main:3,make:[1,3,6,8,13],mandat:2,manner:6,map:8,max_ttl:2,maximum:[0,7,10,11],maxsiz:[0,1,3,6],mean:[],mechan:[1,6],memori:[0,2,7,8],memoryhandl:7,messag:[0,1,2,3,4,6,7,8,9,10,13],met:7,metadata:[1,7],method:[0,1,2,4,6,8,9,10,11,13],metric:6,minimum:13,minsiz:3,minut:7,missi:7,mkdir:3,mode:1,monitor:5,monoton:11,more:[3,6,13],mostli:7,msg:[1,3,6,7,9],msisdn:[1,9],much:3,must:[0,2,4,8,10,11,13],mutual:9,my_app:6,my_brok:[3,6],my_client:3,my_config:6,my_naz_cli:[3,6],my_request:6,my_respons:6,myfil:6,myhook:6,myid12345:6,mylimit:6,mylogg:7,myprometheushook:6,myredisbrok:3,mysmsdb:6,mysteri:7,name:[1,6,7],naz:[0,1,2,4,7,8,9,10,11,12,13],naz_benchmarks_queu:3,nazclienterror:1,nazcodec:5,nazizi:6,ncodec:8,neccesari:0,need:[3,6],network:1,new_msg:6,next:3,next_sequ:11,none:[0,1,2,3,4,7,8,9,10,11,13],not_throttl:13,note:[0,2],notif:[2,6],notset:[],now:3,npi:1,number:[0,1,2,6,7,12,13],object:[1,8,9,12],observ:5,occur:6,ofcours:6,off:3,okai:3,omit:2,onc:3,one:[2,3,4,8,9],onli:[0,3,6,7,9],option:[2,3,12],order:[0,3,8],origin:1,other:[2,3,6],ought:11,our:3,out:[1,3,6],outgo:6,output:8,over:[1,6,13],own:[3,6],paramet:[0,1,2,4,6,7,8,9,10,12,13],pars:1,parti:6,particular:[2,3,13],pass:[1,3,6,7,9],password:[1,3,6],path:[3,6],pdu:[1,4,6,9],per:[6,7],percent:13,percentag:[6,13],period:[1,6],pid:3,pip:[3,6],place:[3,6],plan:1,port:[1,3],possibl:3,postgr:9,predefin:1,previous:[2,4],print:6,prioriti:1,priority_flag:1,problem:7,process:7,prod:3,product:6,prometheu:6,prometheus_cli:6,properti:12,protocol:[0,1,3,5,6],protocol_id:1,provid:8,purchas:3,purpos:[0,6],put:[0,2,7],put_nowait:6,python3:6,python:[1,2,3,6,7,8,9],python_path:3,queu:[1,6,9],queue:[0,1,3,6,13],queue_nam:3,rabbitmq:[3,6,9],rais:1,rang:[1,6,11],rate:[1,3,5,10,13],ratelimit:[1,5,6],re_establish_conn_bind:1,reach:11,read:[1,6],readi:3,real:3,reason:[2,6,13],rebind:1,receipt:1,receipted_message_id:2,receiv:[1,4,9],receive_data:[1,3,6],recipi:1,recognis:8,reconnect:1,record:[6,7],redi:[3,6,9],registered_deliveri:1,regul:13,relat:[1,2,3],releas:6,reliabl:2,render:[6,7],replac:[1,3],replace_if_present_flag:1,repli:[6,13],repo:6,represenst:12,represent:9,requ:9,request:[1,4,6,10,11,13],requir:[1,6],respect:1,respond:13,respons:[1,3,4,6,11,13],ring:7,round:6,rout:[1,6],run:[1,3,6],run_until_complet:[1,3,6],sai:6,said:1,same:[],sample_s:[6,13],sampling_period:[6,13],san:6,satisfi:[0,2,3,4,6,10,11,13],save:[0,9],schedul:1,schedule_delivery_tim:1,scheme:8,sdk:6,second:[1,2,6,7,10,13],section:8,see:[3,4,8,11],self:[3,4,6,11,13],send:[1,3,4,6,9,10,13],send_data:[1,3],send_messag:3,send_messsag:10,send_rat:[6,10],send_request:3,sender:[1,9],sens:6,sent:[1,3,4,8,9],sentri:6,sentry_sdk:6,sequenc:[1,2,5],sequence_gener:1,sequence_numb:[1,2,11],sequence_number1:2,serial:[0,9],serv:1,server:[1,3,6,10],servic:[1,6],service_typ:1,session:[1,12],set:[3,6,7,8],setformatt:[6,7],setlevel:[6,7],setmessagestatehook:6,setup:6,sever:7,ship:[3,6,9],shoe:3,shop:9,short_messag:[1,3,6,9],should:[0,1,2,3,4,6,7,8,9,10,11,13],shouldflush:7,show:[3,6],shown:[0,2,4,10,11,13],shutdown:1,signal:1,signatur:[0,2,4,10,11,13],signifi:1,simpl:[2,6],simplebrok:[0,1,6],simplecodec:8,simplecorrelat:2,simplehook:[4,6],simplelogg:[6,7],simpler:[],simpleratelimit:[6,10],simplesequencegener:11,simplethrottlehandl:[6,13],simul:[3,6],singl:1,situat:8,size:0,sleep:3,slot:8,sm_default_msg_id:1,sme:1,smpp:[1,2,3,6,8,11,12,13],smpp_command:[1,2,3,4,6,9],smpp_server:3,smppclient1:[1,3,6],smppcommand:[6,9,12],smppcommandstatu:12,smppdatacod:12,smppoptionaltag:12,smppsessionst:12,smsc:[1,2,3,4,6,8,9,10,13],smsc_host:[1,3,6],smsc_message_id1:2,smsc_message_id:2,smsc_port:[1,3,6],smstabl:6,socket:1,socket_timeout:1,softwar:3,some:[1,9],sometim:6,sourc:[0,1,2,4,7,8,9,10,11,12,13],source_addr:[1,3,6,9],source_addr_npi:1,source_addr_ton:1,spec:8,specif:[1,8,11],specifi:[2,6,9,10],sql:6,sqlite3:6,stage:3,standard:8,standardconnectionhandl:3,start:[1,3,6,13],state:[1,3,4,5,6,8],statehook:6,statement:7,statu:[1,4,6,12,13],status:12,stderr:[],stdlib:7,stdout:7,stop:6,storag:2,store:[0,1,2,3,7,8],stored_at:2,str:[1,2,4,6,7,8,9],stream:7,streamhandl:[6,7],streamread:8,streamwrit:8,strict:8,string:[0,1,2,4,8,9],string_to_encod:[],structur:7,style:6,submit:[1,3],submit_sm:[1,2,3,4,6,9],submit_sm_resp:[2,3,4],success:3,suppli:[2,4,6],support:[1,6],suppos:6,surpass:6,system:1,system_id:[1,3,6],system_typ:1,tabl:6,tag:[2,12],take:[3,6],taken:7,talk:[3,6],target:7,targetlevel:7,task:[1,6],tell:7,termin:[1,6],test:[0,1,6],than:[6,13],thank:[3,9],thei:3,them:1,thi:[0,1,2,3,4,6,7,8,9,10,11,13],thing:3,third:6,those:6,throtll:[6,13],throttl:[1,3,5],throttle_delai:13,throttle_handl:[1,6],throttle_wait:13,throttler:6,through:3,thu:[6,13],time:[1,2,13],timeout:3,timestamp:3,tmp:[3,6],to_json:[0,3,9],to_smsc:[4,6],todo:1,token:[6,10],total:[6,13],track:[2,3,4],tracker:5,tracking_cod:3,tranceiver_bind:[1,6],transceiv:1,transfer:6,trigger:7,tupl:[2,8,12],tweet:7,two:6,type:[0,1,2,4,7,8,9,10,11,13],typic:3,ucs2:8,ultim:[],unbind:[1,6],unbind_resp:1,under:[6,13],union:[1,2,7,9],uniqu:[1,2,7,9],updat:6,upto:6,url:7,usag:[3,5,7,8,9,10],use:[0,2,3,6,7,9],used:[0,1,3,6,7,8,9],user:[0,1,2,4,10,11,13],uses:[1,2,6,8],using:[1,2,5,6,10],usual:[6,8],utf8:[],utf:[],valid:1,validity_period:1,valu:[2,6,7,12],variou:[1,3,12],version:[1,3,6,9],via:[1,6,13],wai:[3,6,13],wait:[1,3,13],want:[2,3,4,6],watch:6,web_request:7,wether:13,what:[1,3,6,9],whatev:[6,13],when:[1,3,4,6,7,11,13],whenev:6,where:[3,6],wherea:3,whether:[1,3,7],which:[1,3,6,7,8,10,11,12,13],who:3,wikipedia:6,work:[6,13],world:6,would:[1,6,9],wrap:[2,11],wrapper:[],write:[1,6],www:7,you:[0,1,3,6,7,9,10],your:[3,6,9],your_sentry_project_id:6,your_sentry_public_kei:6,zero:8},titles:["broker","Client","correlater","Example demo of using naz","hooks","naz - naz is an async SMPP client.","Introduction to naz","log","nazcodec","protocol","ratelimiter","sequence","state","throttle"],titleterms:{api:5,app:6,async:[5,6],benchmark:6,broker:[0,6],bug:6,cli:6,client:[1,5],content:5,correlat:2,demo:3,everywher:6,exampl:3,featur:6,handl:6,hook:[4,6],instal:6,integr:6,introduct:6,librari:6,limit:6,log:[6,7],monitor:6,naz:[3,5,6],nazcodec:8,observ:6,protocol:9,rate:6,ratelimit:10,refer:5,sequenc:11,smpp:5,state:12,throttl:[6,13],tracker:6,usag:6,using:3}}) \ No newline at end of file +Search.setIndex({docnames:["broker","client","correlater","example_demo","hooks","index","introduction","log","codec","protocol","ratelimiter","sequence","state","throttle"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["broker.rst","client.rst","correlater.rst","example_demo.rst","hooks.rst","index.rst","introduction.rst","log.rst","codec.rst","protocol.rst","ratelimiter.rst","sequence.rst","state.rst","throttle.rst"],objects:{"naz.broker":{BaseBroker:[0,1,1,""],SimpleBroker:[0,1,1,""]},"naz.broker.BaseBroker":{dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.broker.SimpleBroker":{__init__:[0,2,1,""],dequeue:[0,2,1,""],enqueue:[0,2,1,""]},"naz.client":{Client:[1,1,1,""],NazClientError:[1,3,1,""]},"naz.client.Client":{__init__:[1,2,1,""],command_handlers:[1,2,1,""],connect:[1,2,1,""],deliver_sm_resp:[1,2,1,""],dequeue_messages:[1,2,1,""],enquire_link:[1,2,1,""],enquire_link_resp:[1,2,1,""],re_establish_conn_bind:[1,2,1,""],receive_data:[1,2,1,""],send_data:[1,2,1,""],shutdown:[1,2,1,""],submit_sm:[1,2,1,""],tranceiver_bind:[1,2,1,""],unbind:[1,2,1,""],unbind_resp:[1,2,1,""]},"naz.correlater":{BaseCorrelater:[2,1,1,""],SimpleCorrelater:[2,1,1,""]},"naz.correlater.BaseCorrelater":{get:[2,2,1,""],put:[2,2,1,""]},"naz.correlater.SimpleCorrelater":{__init__:[2,2,1,""],get:[2,2,1,""],put:[2,2,1,""]},"naz.hooks":{BaseHook:[4,1,1,""],SimpleHook:[4,1,1,""]},"naz.hooks.BaseHook":{from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.hooks.SimpleHook":{__init__:[4,2,1,""],from_smsc:[4,2,1,""],to_smsc:[4,2,1,""]},"naz.log":{BreachHandler:[7,1,1,""],SimpleLogger:[7,1,1,""]},"naz.log.BreachHandler":{__init__:[7,2,1,""],emit:[7,2,1,""],shouldFlush:[7,2,1,""]},"naz.log.SimpleLogger":{__init__:[7,2,1,""],log:[7,2,1,""]},"naz.codec":{SimpleCodec:[8,1,1,""]},"naz.codec.SimpleCodec":{__init__:[8,2,1,""],decode:[8,2,1,""],encode:[8,2,1,""]},"naz.protocol":{Message:[9,1,1,""]},"naz.protocol.Message":{__init__:[9,2,1,""],from_json:[9,2,1,""],to_json:[9,2,1,""]},"naz.ratelimiter":{BaseRateLimiter:[10,1,1,""],SimpleRateLimiter:[10,1,1,""]},"naz.ratelimiter.BaseRateLimiter":{limit:[10,2,1,""]},"naz.ratelimiter.SimpleRateLimiter":{__init__:[10,2,1,""],limit:[10,2,1,""]},"naz.sequence":{BaseSequenceGenerator:[11,1,1,""],SimpleSequenceGenerator:[11,1,1,""]},"naz.sequence.BaseSequenceGenerator":{next_sequence:[11,2,1,""]},"naz.sequence.SimpleSequenceGenerator":{__init__:[11,2,1,""],next_sequence:[11,2,1,""]},"naz.state":{CommandStatus:[12,1,1,""],DataCoding:[12,1,1,""],SmppCommand:[12,1,1,""],SmppCommandStatus:[12,1,1,""],SmppDataCoding:[12,1,1,""],SmppOptionalTag:[12,1,1,""],SmppSessionState:[12,1,1,""]},"naz.state.CommandStatus":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.state.DataCoding":{code:[12,2,1,""],description:[12,2,1,""],value:[12,2,1,""]},"naz.throttle":{BaseThrottleHandler:[13,1,1,""],SimpleThrottleHandler:[13,1,1,""]},"naz.throttle.BaseThrottleHandler":{allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},"naz.throttle.SimpleThrottleHandler":{__init__:[13,2,1,""],allow_request:[13,2,1,""],not_throttled:[13,2,1,""],throttle_delay:[13,2,1,""],throttled:[13,2,1,""]},naz:{broker:[0,0,0,"-"],client:[1,0,0,"-"],correlater:[2,0,0,"-"],hooks:[4,0,0,"-"],log:[7,0,0,"-"],codec:[8,0,0,"-"],protocol:[9,0,0,"-"],ratelimiter:[10,0,0,"-"],sequence:[11,0,0,"-"],state:[12,0,0,"-"],throttle:[13,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","exception","Python exception"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:exception"},terms:{"0r5nd6bsd3g4atwux":3,"16be":[],"20min":6,"2billion":2,"7wjf935mqgsjplq7e":3,"\u03c3cmt":3,"\u30c4":6,"abstract":[0,2,4,10,11,13],"byte":[1,4,8,9],"class":[0,1,2,3,4,6,7,8,9,10,11,12,13],"default":[6,7,8],"final":6,"float":[1,2,7,10,13],"function":1,"h\u00fclk":[],"import":[1,3,6,7,9,10,13],"int":[0,1,2,7,8,9,11],"long":[3,6,13],"return":[0,1,2,3,4,6,7,8,9,10,11,13],"short":[1,6],"static":9,"super":6,"true":[3,7],"try":6,"while":[1,3],"zo\u00e3":8,"zo\u00eb":8,AND:13,AWS:3,And:[3,6],But:3,For:[3,6],One:2,REs:6,SMS:1,SQS:3,SimpleCodec:[],That:[1,6],The:[0,1,2,3,6,8,9,11,13],Use:8,With:3,__init__:[0,1,2,3,4,6,7,8,9,10,11,13],_get_redi:3,_handler:7,_parse_response_pdu:1,_process_msg:6,_redi:3,abc:[0,2,4,10,11,13],abil:6,abl:[0,3,8,9],about:6,abov:[6,13],accept:3,acct:1,accur:[4,11],acknowledg:1,activ:[1,6],addhandl:[6,7],addit:1,addr_npi:1,addr_ton:1,address:[1,3],address_rang:1,after:[1,2,4,6,13],again:13,agnost:3,aha:7,aioredi:3,algorithm:[6,10],alia:12,all:[3,6,7],allow:[6,10,11],allow_request:13,alpin:3,also:[1,2,3,6,8,9,13],altern:7,among:2,ani:[1,2,3,4,6,9,13],annot:6,anoth:[2,3,6],anymor:13,anyth:6,api:6,app:[3,5],append:7,appli:[7,8],applic:[1,2,3,4,6,9],arg:[6,7],argument:[3,7],around:[2,11],arrang:1,articl:7,artist:6,associ:1,async:[0,1,2,3,4,10,13],asynchron:1,asyncio:[1,3,6],attach:7,authent:1,auto:2,avail:3,await:[3,6,10],awesom:3,awesomestor:3,b526gdnxfbf8sqlzz:3,backward:6,band:6,base:[0,1,2,4,7,8,9,10,11,12,13],basebrok:[0,1,3,6],basecorrelat:[1,2],basehook:[1,4,6],basenazcodec:[],baseratelimit:[1,6,10],basesequencegener:[1,11],basethrottlehandl:[1,6,13],basi:2,been:[1,3,7,8],befor:[1,3,4,6,7,13],benchmark:5,best:2,between:[1,2,6],bf_getreadbuf:8,bind:[1,6],bind_receiv:1,bind_transceiv:1,bind_transceiver_resp:1,bit:[7,8],block:1,bodi:1,body_data:1,bool:[1,7,13],both:3,breachhandl:7,bring:6,broker:[1,3,5,9],brpop:3,bucket:[6,10],buffer:[1,7,8],bug:5,busi:3,byte_str:[],calcul:13,call:[0,1,2,3,4,6,7,9,13],can:[0,1,3,6,7,8,9,10,12],capac:7,center:6,certain:7,chang:[3,6],charact:8,check:[1,6,7],child:[1,9],choic:[3,6],cleanli:1,cli:[3,5],client:[3,6,9,10,13],client_id:[1,3,6],close:[6,7],cmt:1,code:[1,3,9,12],codec:[1,8,9],codec_class:[1,9],com:7,come:2,command:[2,3,4,9,12],command_handl:[1,3],command_statu:3,command_status_valu:1,commandlin:6,commandstatu:[4,12],commit:6,commun:3,compos:6,condit:[7,13],config:6,confirm:3,conn:6,connect:[1,3,6],connection_lost:3,consult:[3,6],consum:[6,8],contain:[3,6],content:6,continu:[1,6],control:[1,6,10],correl:[2,4,9,11],correlat:5,correlatinid:6,correlation_handl:1,could:7,counter:6,creat:[3,6],create_redis_pool:3,cthank:3,current:[3,6,9],cursor:6,custom:[3,6,10],damn:7,data:[1,4,6,12],databas:6,datacod:12,debug:[6,7],decid:[6,7,13],decis:13,declar:[1,6],decod:[1,3,8,9],def:[3,6],defin:8,delet:2,deliv:6,deliver_sm:[2,6],deliver_sm_resp:1,deliveri:[1,2,6],demo:[0,5,6],demo_naz:3,deni:[6,13],deny_request_at:[6,13],depend:6,dequed_item:3,dequeu:[0,1,3,6],dequeue_messag:[1,3,6],deriv:6,descript:[6,12],deseri:9,design:[1,6],dest_addr_npi:1,dest_addr_ton:1,destin:1,destination_addr:[1,3,6,9],determin:13,develop:[3,6],diagnost:7,dict:[1,7],dictionari:2,did:7,differ:[1,2,4,9],directori:[3,6],doc:6,docker:[3,6],document:3,doe:[1,6,7,10,13],domain:1,done:[2,3],dot:[3,6],drain_dur:1,dry:3,durat:[1,13],each:6,easy_decod:[],easy_encod:[],effici:8,effort:2,elliot:7,els:[3,9],emit:7,emoji:6,empti:[3,8],enabl:[9,13],encod:[1,8,9,12],end:3,enqueu:[0,1,3,6],enquire_link:[1,6],enquire_link_interv:1,enquire_link_resp:1,entiti:6,environ:6,error:[1,6,7,8],errors_level:[],esm:[1,6],esm_class:1,esme_rmsgq:13,esme_rthrottl:6,etc:[3,7,9],even:[6,7],event:[3,6,7],everi:7,everytim:13,everywher:5,evolv:9,exampl:[1,5,6,7,8,10],example_config:6,examplebrok:6,exc_info:7,exce:13,exceed:7,except:[1,6,7],exclus:9,execut:[3,6],exist:1,exit:3,expect:3,expir:2,extern:6,fals:[1,3,7,13],featur:[2,5],field:[1,12],file:[3,6,7,8],flag:1,flow:1,flush:7,flushlevel:7,flushonclos:7,forc:3,format:[3,6,9],formatt:[6,7],found:6,from:[1,2,3,4,6,7,9,13],from_json:[0,3,9],from_smsc:[4,6],full:[1,4,9,13],futur:9,gatewai:[1,6],gather:[1,6],gener:[1,6,11],get:[1,2,3,6,9,13],get_event_loop:[1,3,6],getenv:1,getlogg:7,give:[3,6],given:[2,7],goe:13,going:[2,3],good:[6,7],googl:7,got:[7,13],greater:[6,13],gsm0338:8,gsm:8,guarante:2,had:[2,3,4],hand:1,handl:[3,5,8,13],handler:[1,6,7,13],happen:6,happili:3,has:[0,6,9],hasn:7,have:[3,6,7,8,13],heartbeat:7,heartbeatinterv:7,hello:[6,9],help:[3,4,11],here:6,higher:7,hip:6,hold:6,hook:[1,3,5,9],hook_metadata1:2,hook_metadata2:2,hook_metadata:[1,2,4,6,9],hop:6,host:[1,3,6],houston:7,how:[3,6,13],howev:[2,3],http:[6,7],ident:1,identifi:[1,2,9],ignor:[],implement:[0,1,2,3,4,6,7,8,10,11,13],implemet:1,implemnet:3,impos:13,inc:6,includ:[3,7],incompat:6,increas:11,increment:6,indic:[1,9],info:[6,7],inform:[6,7],inherit:[0,2,4,10,11,13],init:6,initi:[4,11],inject:6,input:8,insid:3,inspir:7,instal:[3,5],instanc:[0,1,3,6,8,9],instantait:3,instanti:[1,3],integ:[7,11],integr:5,interact:1,interfac:[0,2,3,4,6,10,11,13],interface_vers:1,introduct:5,issu:6,item:[0,1,2,3,6],its:[1,3],itself:13,jayz:7,join:6,json:[0,7,9],json_messag:9,just:[1,4,6,13],kafka:3,keep:[6,8],kei:[2,6,9],kenyan:6,keyword:7,klqk248jsk8:3,komuw:3,kvlog:6,kvlogger:6,kwarg:[6,7],last:13,later:[1,6,9],learn:3,least:7,leav:9,length:8,let:[3,6,10],level:[1,6,7],leverag:6,librari:5,like:[1,2,6,7,9],limit:[1,3,5,10,13],line:3,list:1,listen:[1,3],load:[6,13],localhost:3,log:[1,3,4,5,9],log_id1:2,log_id2:2,log_id:[1,2,3,4,6,9],log_metadata:[6,7],logger:[1,4,6,7,10,13],logger_nam:7,logic:3,look:[2,3,6],loop:[1,3,6],lost:1,lot:3,lpush:3,mai:[2,4,6,8,9,10,13],main:3,make:[1,3,6,8,13],mandat:2,manner:6,map:8,max_ttl:2,maximum:[0,7,10,11],maxsiz:[0,1,3,6],mean:[],mechan:[1,6],memori:[0,2,7,8],memoryhandl:7,messag:[0,1,2,3,4,6,7,8,9,10,13],met:7,metadata:[1,7],method:[0,1,2,4,6,8,9,10,11,13],metric:6,minimum:13,minsiz:3,minut:7,missi:7,mkdir:3,mode:1,monitor:5,monoton:11,more:[3,6,13],mostli:7,msg:[1,3,6,7,9],msisdn:[1,9],much:3,must:[0,2,4,8,10,11,13],mutual:9,my_app:6,my_brok:[3,6],my_client:3,my_config:6,my_naz_cli:[3,6],my_request:6,my_respons:6,myfil:6,myhook:6,myid12345:6,mylimit:6,mylogg:7,myprometheushook:6,myredisbrok:3,mysmsdb:6,mysteri:7,name:[1,6,7],naz:[0,1,2,4,7,8,9,10,11,12,13],naz_benchmarks_queu:3,nazclienterror:1,codec:5,nazizi:6,ncodec:8,neccesari:0,need:[3,6],network:1,new_msg:6,next:3,next_sequ:11,none:[0,1,2,3,4,7,8,9,10,11,13],not_throttl:13,note:[0,2],notif:[2,6],notset:[],now:3,npi:1,number:[0,1,2,6,7,12,13],object:[1,8,9,12],observ:5,occur:6,ofcours:6,off:3,okai:3,omit:2,onc:3,one:[2,3,4,8,9],onli:[0,3,6,7,9],option:[2,3,12],order:[0,3,8],origin:1,other:[2,3,6],ought:11,our:3,out:[1,3,6],outgo:6,output:8,over:[1,6,13],own:[3,6],paramet:[0,1,2,4,6,7,8,9,10,12,13],pars:1,parti:6,particular:[2,3,13],pass:[1,3,6,7,9],password:[1,3,6],path:[3,6],pdu:[1,4,6,9],per:[6,7],percent:13,percentag:[6,13],period:[1,6],pid:3,pip:[3,6],place:[3,6],plan:1,port:[1,3],possibl:3,postgr:9,predefin:1,previous:[2,4],print:6,prioriti:1,priority_flag:1,problem:7,process:7,prod:3,product:6,prometheu:6,prometheus_cli:6,properti:12,protocol:[0,1,3,5,6],protocol_id:1,provid:8,purchas:3,purpos:[0,6],put:[0,2,7],put_nowait:6,python3:6,python:[1,2,3,6,7,8,9],python_path:3,queu:[1,6,9],queue:[0,1,3,6,13],queue_nam:3,rabbitmq:[3,6,9],rais:1,rang:[1,6,11],rate:[1,3,5,10,13],ratelimit:[1,5,6],re_establish_conn_bind:1,reach:11,read:[1,6],readi:3,real:3,reason:[2,6,13],rebind:1,receipt:1,receipted_message_id:2,receiv:[1,4,9],receive_data:[1,3,6],recipi:1,recognis:8,reconnect:1,record:[6,7],redi:[3,6,9],registered_deliveri:1,regul:13,relat:[1,2,3],releas:6,reliabl:2,render:[6,7],replac:[1,3],replace_if_present_flag:1,repli:[6,13],repo:6,represenst:12,represent:9,requ:9,request:[1,4,6,10,11,13],requir:[1,6],respect:1,respond:13,respons:[1,3,4,6,11,13],ring:7,round:6,rout:[1,6],run:[1,3,6],run_until_complet:[1,3,6],sai:6,said:1,same:[],sample_s:[6,13],sampling_period:[6,13],san:6,satisfi:[0,2,3,4,6,10,11,13],save:[0,9],schedul:1,schedule_delivery_tim:1,scheme:8,sdk:6,second:[1,2,6,7,10,13],section:8,see:[3,4,8,11],self:[3,4,6,11,13],send:[1,3,4,6,9,10,13],send_data:[1,3],send_messag:3,send_messsag:10,send_rat:[6,10],send_request:3,sender:[1,9],sens:6,sent:[1,3,4,8,9],sentri:6,sentry_sdk:6,sequenc:[1,2,5],sequence_gener:1,sequence_numb:[1,2,11],sequence_number1:2,serial:[0,9],serv:1,server:[1,3,6,10],servic:[1,6],service_typ:1,session:[1,12],set:[3,6,7,8],setformatt:[6,7],setlevel:[6,7],setmessagestatehook:6,setup:6,sever:7,ship:[3,6,9],shoe:3,shop:9,short_messag:[1,3,6,9],should:[0,1,2,3,4,6,7,8,9,10,11,13],shouldflush:7,show:[3,6],shown:[0,2,4,10,11,13],shutdown:1,signal:1,signatur:[0,2,4,10,11,13],signifi:1,simpl:[2,6],simplebrok:[0,1,6],simplecodec:8,simplecorrelat:2,simplehook:[4,6],simplelogg:[6,7],simpler:[],simpleratelimit:[6,10],simplesequencegener:11,simplethrottlehandl:[6,13],simul:[3,6],singl:1,situat:8,size:0,sleep:3,slot:8,sm_default_msg_id:1,sme:1,smpp:[1,2,3,6,8,11,12,13],smpp_command:[1,2,3,4,6,9],smpp_server:3,smppclient1:[1,3,6],smppcommand:[6,9,12],smppcommandstatu:12,smppdatacod:12,smppoptionaltag:12,smppsessionst:12,smsc:[1,2,3,4,6,8,9,10,13],smsc_host:[1,3,6],smsc_message_id1:2,smsc_message_id:2,smsc_port:[1,3,6],smstabl:6,socket:1,socket_timeout:1,softwar:3,some:[1,9],sometim:6,sourc:[0,1,2,4,7,8,9,10,11,12,13],source_addr:[1,3,6,9],source_addr_npi:1,source_addr_ton:1,spec:8,specif:[1,8,11],specifi:[2,6,9,10],sql:6,sqlite3:6,stage:3,standard:8,standardconnectionhandl:3,start:[1,3,6,13],state:[1,3,4,5,6,8],statehook:6,statement:7,statu:[1,4,6,12,13],status:12,stderr:[],stdlib:7,stdout:7,stop:6,storag:2,store:[0,1,2,3,7,8],stored_at:2,str:[1,2,4,6,7,8,9],stream:7,streamhandl:[6,7],streamread:8,streamwrit:8,strict:8,string:[0,1,2,4,8,9],string_to_encod:[],structur:7,style:6,submit:[1,3],submit_sm:[1,2,3,4,6,9],submit_sm_resp:[2,3,4],success:3,suppli:[2,4,6],support:[1,6],suppos:6,surpass:6,system:1,system_id:[1,3,6],system_typ:1,tabl:6,tag:[2,12],take:[3,6],taken:7,talk:[3,6],target:7,targetlevel:7,task:[1,6],tell:7,termin:[1,6],test:[0,1,6],than:[6,13],thank:[3,9],thei:3,them:1,thi:[0,1,2,3,4,6,7,8,9,10,11,13],thing:3,third:6,those:6,throtll:[6,13],throttl:[1,3,5],throttle_delai:13,throttle_handl:[1,6],throttle_wait:13,throttler:6,through:3,thu:[6,13],time:[1,2,13],timeout:3,timestamp:3,tmp:[3,6],to_json:[0,3,9],to_smsc:[4,6],todo:1,token:[6,10],total:[6,13],track:[2,3,4],tracker:5,tracking_cod:3,tranceiver_bind:[1,6],transceiv:1,transfer:6,trigger:7,tupl:[2,8,12],tweet:7,two:6,type:[0,1,2,4,7,8,9,10,11,13],typic:3,ucs2:8,ultim:[],unbind:[1,6],unbind_resp:1,under:[6,13],union:[1,2,7,9],uniqu:[1,2,7,9],updat:6,upto:6,url:7,usag:[3,5,7,8,9,10],use:[0,2,3,6,7,9],used:[0,1,3,6,7,8,9],user:[0,1,2,4,10,11,13],uses:[1,2,6,8],using:[1,2,5,6,10],usual:[6,8],utf8:[],utf:[],valid:1,validity_period:1,valu:[2,6,7,12],variou:[1,3,12],version:[1,3,6,9],via:[1,6,13],wai:[3,6,13],wait:[1,3,13],want:[2,3,4,6],watch:6,web_request:7,wether:13,what:[1,3,6,9],whatev:[6,13],when:[1,3,4,6,7,11,13],whenev:6,where:[3,6],wherea:3,whether:[1,3,7],which:[1,3,6,7,8,10,11,12,13],who:3,wikipedia:6,work:[6,13],world:6,would:[1,6,9],wrap:[2,11],wrapper:[],write:[1,6],www:7,you:[0,1,3,6,7,9,10],your:[3,6,9],your_sentry_project_id:6,your_sentry_public_kei:6,zero:8},titles:["broker","Client","correlater","Example demo of using naz","hooks","naz - naz is an async SMPP client.","Introduction to naz","log","codec","protocol","ratelimiter","sequence","state","throttle"],titleterms:{api:5,app:6,async:[5,6],benchmark:6,broker:[0,6],bug:6,cli:6,client:[1,5],content:5,correlat:2,demo:3,everywher:6,exampl:3,featur:6,handl:6,hook:[4,6],instal:6,integr:6,introduct:6,librari:6,limit:6,log:[6,7],monitor:6,naz:[3,5,6],codec:8,observ:6,protocol:9,rate:6,ratelimit:10,refer:5,sequenc:11,smpp:5,state:12,throttl:[6,13],tracker:6,usag:6,using:3}}) \ No newline at end of file diff --git a/documentation/sphinx-docs/index.rst b/documentation/sphinx-docs/index.rst index 046506da..c1bb9f6d 100644 --- a/documentation/sphinx-docs/index.rst +++ b/documentation/sphinx-docs/index.rst @@ -19,7 +19,7 @@ API reference protocol correlater hooks - nazcodec + codec broker ratelimiter sequence diff --git a/documentation/sphinx-docs/nazcodec.rst b/documentation/sphinx-docs/nazcodec.rst index b1173fae..42396dfc 100644 --- a/documentation/sphinx-docs/nazcodec.rst +++ b/documentation/sphinx-docs/nazcodec.rst @@ -1,7 +1,7 @@ -nazcodec +codec --------------- -.. automodule:: naz.nazcodec +.. automodule:: naz.codec :members: SimpleCodec :show-inheritance: diff --git a/examples/example_config.py b/examples/example_config.py index 87cc66eb..30f6a26c 100644 --- a/examples/example_config.py +++ b/examples/example_config.py @@ -10,6 +10,6 @@ system_id="smppclient1", password="password", broker=ExampleRedisBroker(), - codec_class=naz.nazcodec.SimpleCodec(encoding="ucs2"), + codec_class=naz.codec.SimpleCodec(encoding="ucs2"), socket_timeout=4.00, ) diff --git a/naz/__init__.py b/naz/__init__.py index 327295ab..acefcc00 100644 --- a/naz/__init__.py +++ b/naz/__init__.py @@ -2,7 +2,7 @@ from . import log # noqa: F401 from . import broker # noqa: F401 -from . import nazcodec # noqa: F401 +from . import codec # noqa: F401 from . import protocol # noqa: F401 from . import throttle # noqa: F401 from . import sequence # noqa: F401 diff --git a/naz/client.py b/naz/client.py index 12897d51..c4dc111e 100644 --- a/naz/client.py +++ b/naz/client.py @@ -12,7 +12,7 @@ # pytype: disable=pyi-error from . import log from . import hooks -from . import nazcodec +from . import codec from . import protocol from . import sequence from . import throttle @@ -236,7 +236,7 @@ def __init__( if codec_class is not None: self.codec_class = codec_class else: - self.codec_class = nazcodec.SimpleCodec() + self.codec_class = codec.SimpleCodec() self.service_type = service_type self.source_addr_ton = source_addr_ton @@ -704,6 +704,9 @@ def _search_by_command_status_value( return val return None + def _easy_encode(self): + self.codec_class.encode(self.service_type) + @staticmethod def _retry_after(current_retries): """ diff --git a/naz/nazcodec.py b/naz/codec.py similarity index 100% rename from naz/nazcodec.py rename to naz/codec.py diff --git a/tests/test_cli.py b/tests/test_cli.py index 3bb02cb2..bc1f17b9 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -47,7 +47,7 @@ def parse_args(self, args=None, namespace=None): ), enquire_link_interval=30.00, rateLimiter=MyRateLimiter(), - codec_class=naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="ignore"), + codec_class=naz.codec.SimpleCodec(encoding="gsm0338", errors_level="ignore"), ) BAD_NAZ_CLIENT = MySeqGen() diff --git a/tests/test_client.py b/tests/test_client.py index 98164bee..80fd9682 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -236,7 +236,7 @@ def mock_create_client(): system_id="smppclient1", password=os.getenv("password", "password"), broker=self.broker, - codec_class=naz.nazcodec.SimpleCodec(encoding=encoding), + codec_class=naz.codec.SimpleCodec(encoding=encoding), ) self.assertRaises(ValueError, mock_create_client) @@ -1075,7 +1075,7 @@ def test_custom_encodings(self): "TestClient", level="DEBUG", handler=naz.log.BreachHandler(capacity=200) ), socket_timeout=0.0000001, - codec_class=naz.nazcodec.SimpleCodec(encoding=encoding), + codec_class=naz.codec.SimpleCodec(encoding=encoding), ) self._run(cli.connect()) self.assertTrue(hasattr(cli.reader, "read")) diff --git a/tests/test_nazcodec.py b/tests/test_codec.py similarity index 69% rename from tests/test_nazcodec.py rename to tests/test_codec.py index 54514878..121a3c7f 100644 --- a/tests/test_nazcodec.py +++ b/tests/test_codec.py @@ -35,94 +35,94 @@ import naz -class TestNazCodec(TestCase): +class TestCodec(TestCase): """ run tests as: python -m unittest discover -v -s . run one testcase as: - python -m unittest -v tests.test_nazcodec.TestNazCodec.test_something + python -m unittest -v tests.test_codec.TestCodec.test_something """ def test_byte_encode_guard(self): - codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") - self.assertRaises(naz.nazcodec.NazCodecException, codec.encode, b"some bytes") + codec = naz.codec.SimpleCodec(encoding="utf-8", errors_level="strict") + self.assertRaises(naz.codec.NazCodecException, codec.encode, b"some bytes") def test_string_decode_guard(self): - codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") - self.assertRaises(naz.nazcodec.NazCodecException, codec.decode, "unicode") + codec = naz.codec.SimpleCodec(encoding="utf-8", errors_level="strict") + self.assertRaises(naz.codec.NazCodecException, codec.decode, "unicode") def test_default_encoding(self): - codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertEqual(codec.encode("a"), b"a") def test_default_decoding(self): - codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertEqual(codec.decode(b"a"), "a") def test_encode_utf8(self): - codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertEqual(codec.encode("Zoë"), b"Zo\xc3\xab") def test_decode_utf8(self): - codec = naz.nazcodec.SimpleCodec(encoding="utf-8", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="utf-8", errors_level="strict") self.assertEqual(codec.decode(b"Zo\xc3\xab"), "Zoë") def test_encode_utf16be(self): - codec = naz.nazcodec.SimpleCodec(encoding="utf-16be", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="utf-16be", errors_level="strict") self.assertEqual(codec.encode("Zoë"), b"\x00Z\x00o\x00\xeb") def test_decode_utf16be(self): - codec = naz.nazcodec.SimpleCodec(encoding="utf-16be", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="utf-16be", errors_level="strict") self.assertEqual(codec.decode(b"\x00Z\x00o\x00\xeb"), "Zoë") def test_encode_ucs2(self): - codec = naz.nazcodec.SimpleCodec(encoding="ucs2", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="ucs2", errors_level="strict") self.assertEqual(codec.encode("Zoë"), b"\x00Z\x00o\x00\xeb") def test_decode_ucs2(self): - codec = naz.nazcodec.SimpleCodec(encoding="ucs2", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="ucs2", errors_level="strict") self.assertEqual(codec.decode(b"\x00Z\x00o\x00\xeb"), "Zoë") def test_encode_gsm0338(self): - codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertEqual( codec.encode("HÜLK"), "".join([chr(code) for code in [72, 94, 76, 75]]).encode() ) def test_encode_gsm0338_extended(self): - codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertEqual( codec.encode("foo €"), "".join([chr(code) for code in [102, 111, 111, 32, 27, 101]]).encode(), ) def test_decode_gsm0338_extended(self): - codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertEqual( codec.decode("".join([chr(code) for code in [102, 111, 111, 32, 27, 101]]).encode()), "foo €", ) def test_encode_gsm0338_strict(self): - codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertRaises(UnicodeEncodeError, codec.encode, "Zoë") def test_encode_gsm0338_ignore(self): - codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="ignore") + codec = naz.codec.SimpleCodec(encoding="gsm0338", errors_level="ignore") self.assertEqual(codec.encode("Zoë"), b"Zo") def test_encode_gsm0338_replace(self): - codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="replace") + codec = naz.codec.SimpleCodec(encoding="gsm0338", errors_level="replace") self.assertEqual(codec.encode("Zoë"), b"Zo?") def test_decode_gsm0338_strict(self): - codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="strict") + codec = naz.codec.SimpleCodec(encoding="gsm0338", errors_level="strict") self.assertRaises(UnicodeDecodeError, codec.decode, "Zoë".encode("utf-8")) def test_decode_gsm0338_ignore(self): - codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="ignore") + codec = naz.codec.SimpleCodec(encoding="gsm0338", errors_level="ignore") self.assertEqual(codec.decode("Zoë".encode("utf-8")), "Zo") def test_decode_gsm0338_replace(self): - codec = naz.nazcodec.SimpleCodec(encoding="gsm0338", errors_level="replace") + codec = naz.codec.SimpleCodec(encoding="gsm0338", errors_level="replace") self.assertEqual(codec.decode("Zoë".encode("utf-8")), "Zo??") diff --git a/tests/test_protocol.py b/tests/test_protocol.py index 9f71b208..b9bf6cfd 100644 --- a/tests/test_protocol.py +++ b/tests/test_protocol.py @@ -46,7 +46,7 @@ def test_json_serialization(self): smpp_command=naz.SmppCommand.BIND_TRANSCEIVER_RESP, log_id="some-log-id", pdu=b"pdu", - codec_class=naz.nazcodec.SimpleCodec(encoding="utf-8"), + codec_class=naz.codec.SimpleCodec(encoding="utf-8"), ) _in_json = proto.to_json() _in_dict = json.loads(_in_json) @@ -75,7 +75,7 @@ def test_json_de_serialization(self): } _in_json = json.dumps(x) proto = naz.protocol.Message.from_json( - _in_json, codec_class=naz.nazcodec.SimpleCodec(encoding="utf-8") + _in_json, codec_class=naz.codec.SimpleCodec(encoding="utf-8") ) self.assertIsInstance(proto, naz.protocol.Message) From 6e296ce239f1b1b0a7e92e43a0b808bb5f5cc01b Mon Sep 17 00:00:00 2001 From: komuw Date: Wed, 4 Dec 2019 16:02:00 +0300 Subject: [PATCH 22/59] r --- docs/_modules/index.html | 3 +- docs/_modules/naz/broker.html | 1 - docs/_modules/naz/client.html | 8 +- docs/_modules/naz/codec.html | 431 +++++++++++++++++++++++++++++ docs/_modules/naz/correlater.html | 1 - docs/_modules/naz/hooks.html | 1 - docs/_modules/naz/log.html | 1 - docs/_modules/naz/protocol.html | 1 - docs/_modules/naz/ratelimiter.html | 1 - docs/_modules/naz/sequence.html | 1 - docs/_modules/naz/state.html | 1 - docs/_modules/naz/throttle.html | 1 - docs/broker.html | 5 +- docs/client.html | 1 - docs/correlater.html | 1 - docs/example_demo.html | 1 - docs/genindex.html | 15 +- docs/hooks.html | 5 +- docs/index.html | 2 - docs/introduction.html | 1 - docs/log.html | 1 - docs/nazcodec.html | 40 +-- docs/objects.inv | Bin 1151 -> 1155 bytes docs/protocol.html | 1 - docs/py-modindex.html | 9 +- docs/ratelimiter.html | 1 - docs/search.html | 1 - docs/searchindex.js | 2 +- docs/sequence.html | 1 - docs/state.html | 1 - docs/throttle.html | 1 - 31 files changed, 467 insertions(+), 73 deletions(-) create mode 100644 docs/_modules/naz/codec.html diff --git a/docs/_modules/index.html b/docs/_modules/index.html index 6bb35a06..7fe23476 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -93,7 +93,6 @@
        • protocol
        • correlater
        • hooks
        • -
        • nazcodec
        • broker
        • ratelimiter
        • sequence
        • @@ -163,10 +162,10 @@

          All modules for which code is available

          • naz.broker
          • naz.client
          • +
          • naz.codec
          • naz.correlater
          • naz.hooks
          • naz.log
          • -
          • naz.nazcodec
          • naz.protocol
          • naz.ratelimiter
          • naz.sequence
          • diff --git a/docs/_modules/naz/broker.html b/docs/_modules/naz/broker.html index 4a519f9d..2f49ba3e 100644 --- a/docs/_modules/naz/broker.html +++ b/docs/_modules/naz/broker.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/_modules/naz/client.html b/docs/_modules/naz/client.html index f00f6a16..92bcca8f 100644 --- a/docs/_modules/naz/client.html +++ b/docs/_modules/naz/client.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • @@ -177,7 +176,7 @@

            Source code for naz.client

             # pytype: disable=pyi-error
             from . import log
             from . import hooks
            -from . import nazcodec
            +from . import codec
             from . import protocol
             from . import sequence
             from . import throttle
            @@ -401,7 +400,7 @@ 

            Source code for naz.client

                     if codec_class is not None:
                         self.codec_class = codec_class
                     else:
            -            self.codec_class = nazcodec.SimpleCodec()
            +            self.codec_class = codec.SimpleCodec()
             
                     self.service_type = service_type
                     self.source_addr_ton = source_addr_ton
            @@ -869,6 +868,9 @@ 

            Source code for naz.client

                                 return val
                     return None
             
            +    def _easy_encode(self):
            +        self.codec_class.encode(self.service_type)
            +
                 @staticmethod
                 def _retry_after(current_retries):
                     """
            diff --git a/docs/_modules/naz/codec.html b/docs/_modules/naz/codec.html
            new file mode 100644
            index 00000000..eeb0d867
            --- /dev/null
            +++ b/docs/_modules/naz/codec.html
            @@ -0,0 +1,431 @@
            +
            +
            +
            +
            +  
            +
            +  
            +  
            +  
            +  
            +  naz.codec — naz v0.7.5 documentation
            +  
            +
            +  
            +  
            +  
            +  
            +    
            +  
            +
            +  
            +  
            +  
            +    
            +      
            +        
            +        
            +        
            +        
            +    
            +    
            +
            +    
            +
            +  
            +  
            +  
            +    
            +     
            +
            +
            +
            +
            +   
            +  
            + + + +
            + + + + + +
            + +
            + + + + + + + + + + + + + + + + + +
            + + + + +
            +
            +
            +
            + +

            Source code for naz.codec

            +# The code in this file is copied from https://github.com/praekelt/vumi/blob/master/vumi/codecs/vumi_codecs.py
            +# which is in turn largely copied from http://stackoverflow.com/questions/13130935/decode-7-bit-gsm
            +# Vumi's license is included below:
            +
            +# Copyright (c) Praekelt Foundation and individual contributors.
            +# All rights reserved.
            +
            +# Redistribution and use in source and binary forms, with or without
            +# modification, are permitted provided that the following conditions are met:
            +
            +#     1.  Redistributions of source code must retain the above copyright notice,
            +#         this list of conditions and the following disclaimer.
            +
            +#     2.  Redistributions in binary form must reproduce the above copyright
            +#         notice, this list of conditions and the following disclaimer in the
            +#         documentation and/or other materials provided with the distribution.
            +
            +#     3.  Neither the name of the Praekelt Foundation nor the names of its
            +#         contributors may be used to endorse or promote products derived from
            +#         this software without specific prior written permission.
            +
            +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
            +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
            +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
            +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
            +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
            +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
            +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
            +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
            +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
            +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
            +# POSSIBILITY OF SUCH DAMAGE.
            +
            +
            +import sys
            +import codecs
            +import typing
            +
            +
            +# An alternative to using this codec module is to use: https://github.com/dsch/gsm0338
            +# however, I'm guessing that vumi has been in use longer and we should thus go with it.
            +
            +
            +class NazCodecException(Exception):
            +    pass
            +
            +
            +class GSM7BitCodec(codecs.Codec):
            +    """
            +    """
            +
            +    gsm_basic_charset = (
            +        "@£$¥èéùìòÇ\nØø\rÅåΔ_ΦΓΛΩΠΨΣΘΞ\x1bÆæßÉ !\"#¤%&'()*+,-./0123456789:;"
            +        "<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑÜ`¿abcdefghijklmnopqrstuvwxyzäö"
            +        "ñüà"
            +    )
            +
            +    gsm_basic_charset_map = dict((l, i) for i, l in enumerate(gsm_basic_charset))
            +
            +    gsm_extension = (
            +        "````````````````````^```````````````````{}`````\\````````````[~]`"
            +        "|````````````````````````````````````€``````````````````````````"
            +    )
            +
            +    gsm_extension_map = dict((l, i) for i, l in enumerate(gsm_extension))
            +
            +    def encode(self, input, errors="strict"):
            +        """
            +        errors can be 'strict', 'replace' or 'ignore'
            +        eg:
            +            xcodec.encode("Zoë","gsm0338") will fail with UnicodeEncodeError
            +            but
            +            xcodec.encode("Zoë","gsm0338", 'replace') will return b'Zo?'
            +            and
            +            xcodec.encode("Zoë","gsm0338", 'ignore') will return b'Zo'
            +        """
            +        result = []
            +        for position, c in enumerate(input):
            +            idx = self.gsm_basic_charset_map.get(c)
            +            if idx is not None:
            +                result.append(chr(idx))
            +                continue
            +            idx = self.gsm_extension_map.get(c)
            +            if idx is not None:
            +                result.append(chr(27) + chr(idx))
            +            else:
            +                result.append(self.handle_encode_error(c, errors, position, input))
            +
            +        obj = "".join(result)
            +        # this is equivalent to;
            +        # import six; six.b('someString')
            +        # see:
            +        # https://github.com/benjaminp/six/blob/68112f3193c7d4bef5ad86ed1b6ed528edd9093d/six.py#L625
            +        obj = obj.encode("latin-1")
            +        return (obj, len(obj))
            +
            +    def handle_encode_error(self, char, handler_type, position, obj):
            +        handler = getattr(self, "handle_encode_%s_error" % (handler_type,), None)
            +        if handler is None:
            +            raise NazCodecException("Invalid errors type %s for GSM7BitCodec", handler_type)
            +        return handler(char, position, obj)
            +
            +    @staticmethod
            +    def handle_encode_strict_error(char, position, obj):
            +        raise UnicodeEncodeError("gsm0338", char, position, position + 1, repr(obj))
            +
            +    @staticmethod
            +    def handle_encode_ignore_error(char, position, obj):
            +        return ""
            +
            +    def handle_encode_replace_error(self, char, position, obj):
            +        return chr(self.gsm_basic_charset_map.get("?"))
            +
            +    def decode(self, input, errors="strict"):
            +        """
            +        errors can be 'strict', 'replace' or 'ignore'
            +        """
            +        res = iter(input)
            +        result = []
            +        for position, c in enumerate(res):
            +            try:
            +                if c == 27:
            +                    c = next(res)
            +                    result.append(self.gsm_extension[c])
            +                else:
            +                    result.append(self.gsm_basic_charset[c])
            +            except IndexError as indexErrorException:
            +                result.append(
            +                    self.handle_decode_error(c, errors, position, input, indexErrorException)
            +                )
            +
            +        obj = "".join(result)
            +        return (obj, len(obj))
            +
            +    def handle_decode_error(self, char, handler_type, position, obj, indexErrorException):
            +        handler = getattr(self, "handle_decode_%s_error" % (handler_type,), None)
            +        if handler is None:
            +            raise NazCodecException("Invalid errors type %s for GSM7BitCodec", handler_type)
            +        return handler(char, position, obj, indexErrorException)
            +
            +    @staticmethod
            +    def handle_decode_strict_error(char, position, obj, indexErrorException):
            +        # https://github.com/google/pytype/issues/349
            +        raise UnicodeDecodeError(
            +            "gsm0338",
            +            chr(char).encode("latin-1"),
            +            position,
            +            position + 1,
            +            repr(obj),  # pytype: disable=wrong-arg-types
            +        ) from indexErrorException
            +
            +    @staticmethod
            +    def handle_decode_ignore_error(char, position, obj, indexErrorException):
            +        return ""
            +
            +    @staticmethod
            +    def handle_decode_replace_error(char, position, obj, indexErrorException):
            +        return "?"
            +
            +
            +class UCS2Codec(codecs.Codec):
            +    """
            +    UCS2 is for all intents & purposes assumed to be the same as
            +    big endian UTF16.
            +    """
            +
            +    def encode(self, input, errors="strict"):
            +        # https://github.com/google/pytype/issues/348
            +        return codecs.utf_16_be_encode(input, errors)  # pytype: disable=module-attr
            +
            +    def decode(self, input, errors="strict"):
            +        return codecs.utf_16_be_decode(input, errors)  # pytype: disable=module-attr
            +
            +
            +
            [docs]class SimpleCodec(codecs.Codec): + """ + This is an implementation of `codecs.Codec <https://docs.python.org/3/library/codecs.html>`_ + + SMPP uses a 7-bit GSM character set. This class implements that encoding/decoding scheme. + This class can also be used with the usual `python standard encodings <https://docs.python.org/3/library/codecs.html#standard-encodings>`_ + + example usage: + + .. highlight:: python + .. code-block:: python + + ncodec = SimpleCodec(encoding="ucs2") + + ncodec.encode("Zoë") + ncodec.decode(b'Zo\xc3\xab') + """ + + custom_codecs = {"gsm0338": GSM7BitCodec(), "ucs2": UCS2Codec()} + +
            [docs] def __init__(self, encoding: str = "gsm0338") -> None: + """ + Parameters: + encoding: `encoding <https://docs.python.org/3/library/codecs.html#standard-encodings>`_ used to encode messages been sent to SMSC + The encoding should be one of the encodings recognised by the SMPP specification. See section 5.2.19 of SMPP spec + """ + if not isinstance(encoding, str): + raise ValueError( + "`encoding` should be of type:: `str` You entered: {0}".format(type(encoding)) + ) + self.encoding = encoding
            + +
            [docs] def encode(self, input: str, errors: str = "strict") -> typing.Tuple[bytes, int]: + if not isinstance(input, str): + raise NazCodecException("Only strings accepted for encoding.") + encoding = self.encoding or sys.getdefaultencoding() + if encoding in self.custom_codecs: + encoder = self.custom_codecs[encoding].encode + else: + encoder = codecs.getencoder(encoding) + return encoder(input, errors)
            + +
            [docs] def decode(self, input: bytes, errors: str = "strict") -> typing.Tuple[str, int]: + if not isinstance(input, (bytes, bytearray)): + raise NazCodecException("Only bytestrings accepted for decoding.") + encoding = self.encoding or sys.getdefaultencoding() + if encoding in self.custom_codecs: + decoder = self.custom_codecs[encoding].decode + else: + decoder = codecs.getdecoder(encoding) + return decoder(input, errors)
            +
            + +
            + +
            + + +
            +
            + +
            + +
            + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/_modules/naz/correlater.html b/docs/_modules/naz/correlater.html index 817ae714..e7a4e421 100644 --- a/docs/_modules/naz/correlater.html +++ b/docs/_modules/naz/correlater.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/_modules/naz/hooks.html b/docs/_modules/naz/hooks.html index 1078fb88..1a12a645 100644 --- a/docs/_modules/naz/hooks.html +++ b/docs/_modules/naz/hooks.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/_modules/naz/log.html b/docs/_modules/naz/log.html index e7612a0c..2518a0ca 100644 --- a/docs/_modules/naz/log.html +++ b/docs/_modules/naz/log.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/_modules/naz/protocol.html b/docs/_modules/naz/protocol.html index 57a5f6ed..d3794fc7 100644 --- a/docs/_modules/naz/protocol.html +++ b/docs/_modules/naz/protocol.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/_modules/naz/ratelimiter.html b/docs/_modules/naz/ratelimiter.html index e14ea57b..30a95df1 100644 --- a/docs/_modules/naz/ratelimiter.html +++ b/docs/_modules/naz/ratelimiter.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/_modules/naz/sequence.html b/docs/_modules/naz/sequence.html index 65e46da0..8fb451b8 100644 --- a/docs/_modules/naz/sequence.html +++ b/docs/_modules/naz/sequence.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/_modules/naz/state.html b/docs/_modules/naz/state.html index 15aa3522..881213a1 100644 --- a/docs/_modules/naz/state.html +++ b/docs/_modules/naz/state.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/_modules/naz/throttle.html b/docs/_modules/naz/throttle.html index 21b61a12..f1fb63d3 100644 --- a/docs/_modules/naz/throttle.html +++ b/docs/_modules/naz/throttle.html @@ -93,7 +93,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/broker.html b/docs/broker.html index f710d44d..128d7c18 100644 --- a/docs/broker.html +++ b/docs/broker.html @@ -38,7 +38,7 @@ - + @@ -95,7 +95,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • @@ -280,7 +279,7 @@ - +
            diff --git a/docs/client.html b/docs/client.html index 4f4a9116..f7b5c9da 100644 --- a/docs/client.html +++ b/docs/client.html @@ -95,7 +95,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/correlater.html b/docs/correlater.html index bcf3fabc..9e2786b4 100644 --- a/docs/correlater.html +++ b/docs/correlater.html @@ -95,7 +95,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/example_demo.html b/docs/example_demo.html index 03e7dff0..7d6da222 100644 --- a/docs/example_demo.html +++ b/docs/example_demo.html @@ -95,7 +95,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • diff --git a/docs/genindex.html b/docs/genindex.html index 7d5ef737..6477e5e2 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -94,7 +94,6 @@
          • protocol
          • correlater
          • hooks
          • -
          • nazcodec
          • broker
          • ratelimiter
          • sequence
          • @@ -193,6 +192,8 @@

            _

            -
            -__init__(encoding='gsm0338')[source]
            +
            +__init__(encoding='gsm0338')[source]
            Parameters

            encoding (str) – encoding used to encode messages been sent to SMSC @@ -197,8 +194,8 @@

            -
            -decode(input, errors='strict')[source]
            +
            +decode(input, errors='strict')[source]

            Decodes the object input and returns a tuple (output object, length consumed).

            input must be an object which provides the bf_getreadbuf @@ -220,8 +217,8 @@

            -
            -encode(input, errors='strict')[source]
            +
            +encode(input, errors='strict')[source]

            Encodes the object input and returns a tuple (output object, length consumed).

            errors defines the error handling to apply. It defaults to @@ -249,15 +246,6 @@