Go to file
2021-08-14 12:30:52 -06:00
sms_counter Update main.py 2021-05-26 16:43:40 +03:00
.gitignore Travis CI was enabled 2018-12-26 08:11:53 +03:00
.travis.yml Travis CI file was renamed 2018-12-28 07:47:32 +03:00
LICENSE Initial commit 2016-07-10 21:01:51 +01:00
README.md Updating README to clarify counting 2020-08-27 17:14:29 -06:00
setup.py create python package. refactor the code style according to flake8 2017-02-15 12:02:52 +02:00
tests.py Fixing counting of GSM 7-bit extended chars 2020-08-27 17:13:47 -06:00

sms-counter-python


Build Status

sms-counter-python is a lib that help to count characters of SMS messages.

Get it now

$ pip install git+https://github.com/dedayoa/sms-counter-python.git#egg=sms_counter

Support

  • Python 2
  • Python 3

Requirements

sms-counter-python has no external dependencies outside of the Python standard library

Usage

from sms_counter import SMSCounter

>>> counter = SMSCounter.count('ǂ some-string-to-be-counted ');
>>> counter
>>> {'length': 29, 'messages': 1, 'remaining': 41, 'per_message': 70, 'encoding': 'UTF16'}

The meaning of the length, remaining and per_message values returned by SMSCounter.count() depend on the encoding.

For GSM_7BIT_EX encoding, length, remaining and per_message count the number of 7-bit characters in the message, including the escape character that must precede any characters in the "extended" character set. For example, the length of the message '€' is 2, because it takes 2 7bit characters to encode '€' in GSM_7BIT_EX.

For UTF16 and GSM_7BIT encoding, length, remaining and per_message count the number of characters (since all characters have an equal bit width).

Mentions

License

MIT licensed. See the bundled LICENSE file for more details.