Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues/188: data_coding should not be applied to all C-Octet String fields #190

Merged
merged 61 commits into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
7a822ff
we are only throttled in two cases; ESME_RTHROTTLED and ESME_RMSGQFUL;
komuw Nov 28, 2019
54e3005
call users hook for response earlier
komuw Nov 28, 2019
aabea95
simple logger can log bytes
komuw Nov 28, 2019
468cbd8
simple logger can log bytes
komuw Nov 28, 2019
56754ca
Update log.py
komuw Nov 28, 2019
626d2dc
return a msg with a good error if decode fails
komuw Nov 29, 2019
791c70e
Merge branch 'dynamicLimiting' of github.com:komuw/naz into dynamicLi…
komuw Nov 29, 2019
34a8453
Update nazcodec.py
komuw Dec 3, 2019
6ce04f6
repro
komuw Dec 3, 2019
1587862
repro
komuw Dec 3, 2019
52a9c31
add tests for different encoding
komuw Dec 3, 2019
bf0bd94
init
komuw Dec 3, 2019
679e7c0
r
komuw Dec 3, 2019
1ed8d3c
r
komuw Dec 3, 2019
b1f3de7
r
komuw Dec 3, 2019
8c84764
r
komuw Dec 3, 2019
726852f
r
komuw Dec 3, 2019
19e0d3d
r
komuw Dec 3, 2019
8023d33
r
komuw Dec 3, 2019
1084c8b
repro
komuw Dec 3, 2019
afc37ac
r
komuw Dec 3, 2019
12912b5
r
komuw Dec 4, 2019
6e296ce
r
komuw Dec 4, 2019
b051793
r
komuw Dec 4, 2019
7c4496f
r
komuw Dec 4, 2019
b2091f1
r
komuw Dec 4, 2019
0a65873
r
komuw Dec 4, 2019
cc948d7
r
komuw Dec 4, 2019
6e7c73b
r
komuw Dec 4, 2019
240650a
r
komuw Dec 4, 2019
64197d3
r
komuw Dec 4, 2019
afe5dbf
r
komuw Dec 4, 2019
c376330
r
komuw Dec 4, 2019
70ebe59
r
komuw Dec 4, 2019
82aae3c
r
komuw Dec 4, 2019
3777864
r
komuw Dec 4, 2019
e2df69b
r
komuw Dec 4, 2019
551459e
r
komuw Dec 4, 2019
4f5b2e4
r
komuw Dec 4, 2019
c1e94e8
r
komuw Dec 4, 2019
5236660
r
komuw Dec 4, 2019
ec58990
r
komuw Dec 4, 2019
f6215d5
r
komuw Dec 4, 2019
4edc010
r
komuw Dec 4, 2019
3100796
r
komuw Dec 4, 2019
5d44d3a
r
komuw Dec 4, 2019
5350da0
r
komuw Dec 4, 2019
ceeb3ba
r
komuw Dec 4, 2019
593c06f
r
komuw Dec 4, 2019
588ecc6
r
komuw Dec 5, 2019
c420f66
r
komuw Dec 5, 2019
b40285e
r
komuw Dec 5, 2019
3048baf
r
komuw Dec 5, 2019
8212a30
all C-octet strings should be encoded as ascii and null terminated
komuw Dec 5, 2019
9df82f0
all C-octet strings should be encoded as ascii and null terminated
komuw Dec 5, 2019
fce0f31
the naz messsage protocol will only use utf8 for encoding/decoding
komuw Dec 5, 2019
552c7d5
r
komuw Dec 5, 2019
bd1c13e
r
komuw Dec 5, 2019
a790f10
r
komuw Dec 5, 2019
e681d8c
r
komuw Dec 5, 2019
7eea435
r
komuw Dec 5, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
static_analysis:
name: static_analysis
runs-on: ubuntu-18.04
timeout-minutes: 5
timeout-minutes: 6
steps:
- name: Set up python
uses: actions/setup-python@v1
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ most recent version is listed first.
- Rename `naz.nazcodec.BaseNazCodec` to `naz.codec.BaseCodec`: https://github.com/komuw/naz/pull/191
- Rename `naz.Client.codec_class` to `naz.Client.codec`: https://github.com/komuw/naz/pull/191
- Add ability for `naz.log.SimpleLogger` to render logs as a python dictionary: https://github.com/komuw/naz/pull/191
- BugFix, `data_coding` should not be applied to all fields that are of type C-octet string: https://github.com/komuw/naz/pull/190
- Have the naz messsage protocol only use utf8 for encoding/decoding: https://github.com/komuw/naz/pull/190


## **version:** v0.7.4
Expand Down
36 changes: 17 additions & 19 deletions docs/_modules/naz/client.html

Large diffs are not rendered by default.

48 changes: 12 additions & 36 deletions docs/_modules/naz/protocol.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/client.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
<dl class="method">
<dt id="naz.client.Client.tranceiver_bind">
<em class="property">async </em><code class="sig-name descname">tranceiver_bind</code><span class="sig-paren">(</span><em class="sig-param">log_id=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/naz/client.html#Client.tranceiver_bind"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#naz.client.Client.tranceiver_bind" title="Permalink to this definition">¶</a></dt>
<dd><p>send a BIND_RECEIVER pdu to SMSC.</p>
<dd><p>send a BIND_TRANSCEIVER pdu to SMSC.</p>
<dl class="field-list simple">
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">None</span></code></p>
Expand Down
18 changes: 7 additions & 11 deletions docs/protocol.html
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
<span id="protocol"></span><h1>protocol<a class="headerlink" href="#module-naz.protocol" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="naz.protocol.Message">
<em class="property">class </em><code class="sig-prename descclassname">naz.protocol.</code><code class="sig-name descname">Message</code><span class="sig-paren">(</span><em class="sig-param">version</em>, <em class="sig-param">smpp_command</em>, <em class="sig-param">log_id</em>, <em class="sig-param">pdu=None</em>, <em class="sig-param">codec=None</em>, <em class="sig-param">short_message=None</em>, <em class="sig-param">source_addr=None</em>, <em class="sig-param">destination_addr=None</em>, <em class="sig-param">hook_metadata=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/naz/protocol.html#Message"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#naz.protocol.Message" title="Permalink to this definition">¶</a></dt>
<em class="property">class </em><code class="sig-prename descclassname">naz.protocol.</code><code class="sig-name descname">Message</code><span class="sig-paren">(</span><em class="sig-param">version</em>, <em class="sig-param">smpp_command</em>, <em class="sig-param">log_id</em>, <em class="sig-param">pdu=None</em>, <em class="sig-param">short_message=None</em>, <em class="sig-param">source_addr=None</em>, <em class="sig-param">destination_addr=None</em>, <em class="sig-param">hook_metadata=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/naz/protocol.html#Message"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#naz.protocol.Message" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>The message protocol for <cite>naz</cite>. It is the code representation of what
gets queued into a naz broker.</p>
Expand All @@ -188,16 +188,16 @@
</div>
<dl class="method">
<dt id="naz.protocol.Message.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">version</em>, <em class="sig-param">smpp_command</em>, <em class="sig-param">log_id</em>, <em class="sig-param">pdu=None</em>, <em class="sig-param">codec=None</em>, <em class="sig-param">short_message=None</em>, <em class="sig-param">source_addr=None</em>, <em class="sig-param">destination_addr=None</em>, <em class="sig-param">hook_metadata=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/naz/protocol.html#Message.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#naz.protocol.Message.__init__" title="Permalink to this definition">¶</a></dt>
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">version</em>, <em class="sig-param">smpp_command</em>, <em class="sig-param">log_id</em>, <em class="sig-param">pdu=None</em>, <em class="sig-param">short_message=None</em>, <em class="sig-param">source_addr=None</em>, <em class="sig-param">destination_addr=None</em>, <em class="sig-param">hook_metadata=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/naz/protocol.html#Message.__init__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#naz.protocol.Message.__init__" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>version</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code>) – This indicates the current version of the naz message protocol. This version will enable naz to be able to evolve in future; a future version of <cite>naz</cite> may ship with a different message protocol.</p></li>
<li><p><strong>smpp_command</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – any one of the SMSC commands eg submit_sm</p></li>
<li><p><strong>log_id</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – a unique identify of this reque</p></li>
<li><p><strong>pdu</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="docutils literal notranslate"><span class="pre">None</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>]) – the full PDU as sent to SMSC. It is mutually exclusive with <cite>short_message</cite>.</p></li>
<li><p><strong>codec</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="docutils literal notranslate"><span class="pre">None</span></code>, <a class="reference internal" href="codec.html#naz.codec.BaseCodec" title="naz.codec.BaseCodec"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCodec</span></code></a>]) – python class instance to be used to encode/decode messages. It should be a child class of <cite>naz.codec.BaseCodec</cite>.
You should only specify this, if you also specified <cite>pdu</cite>, else you can leave it as None.</p></li>
<li><p><strong>pdu</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="docutils literal notranslate"><span class="pre">None</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>]) – the full PDU as sent to SMSC. It is mutually exclusive with <cite>short_message</cite>.
Note that the pdu is a byte that may contain different SMSC fields that are encoded using different schemes.
Some fields may be <cite>struct.pack(“&gt;I”)</cite> others <cite>.encode(“ascii”)</cite> and still others <cite>codec.encode(“ucs2”)</cite></p></li>
<li><p><strong>short_message</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="docutils literal notranslate"><span class="pre">None</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – message to send to SMSC. It is mutually exclusive with <cite>pdu</cite></p></li>
<li><p><strong>source_addr</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="docutils literal notranslate"><span class="pre">None</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – the identifier(eg msisdn) of the message sender.</p></li>
<li><p><strong>destination_addr</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="docutils literal notranslate"><span class="pre">None</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>]) – the identifier(eg msisdn) of the message receiver.</p></li>
Expand All @@ -212,16 +212,12 @@

<dl class="method">
<dt id="naz.protocol.Message.from_json">
<em class="property">static </em><code class="sig-name descname">from_json</code><span class="sig-paren">(</span><em class="sig-param">json_message</em>, <em class="sig-param">codec=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/naz/protocol.html#Message.from_json"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#naz.protocol.Message.from_json" title="Permalink to this definition">¶</a></dt>
<em class="property">static </em><code class="sig-name descname">from_json</code><span class="sig-paren">(</span><em class="sig-param">json_message</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/naz/protocol.html#Message.from_json"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#naz.protocol.Message.from_json" title="Permalink to this definition">¶</a></dt>
<dd><p>Deserializes the message protocol from json. You can use this method if you would
like to return the <cite>Message</cite> from a broker like redis/rabbitmq/postgres etc.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>json_message</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – <cite>naz.protocol.Message</cite> in json format.</p></li>
<li><p><strong>codec</strong> (<code class="xref py py-data docutils literal notranslate"><span class="pre">Union</span></code>[<code class="docutils literal notranslate"><span class="pre">None</span></code>, <a class="reference internal" href="codec.html#naz.codec.BaseCodec" title="naz.codec.BaseCodec"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseCodec</span></code></a>]) – python class instance to be used to encode/decode messages. It should be a child class of <cite>naz.codec.BaseCodec</cite>.
You should only specify this, if <cite>json_message</cite> has a key called <cite>pdu</cite> and it is not None.</p></li>
</ul>
<dd class="field-odd"><p><strong>json_message</strong> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>) – <cite>naz.protocol.Message</cite> in json format.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><a class="reference internal" href="#naz.protocol.Message" title="naz.protocol.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a></p>
Expand Down
Loading