sms-counter-python/README.md

41 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

2016-07-10 20:06:42 +00:00
# sms-counter-python
----
[![Build Status](https://travis-ci.com/uralov/sms-counter-python.svg?branch=master)](https://travis-ci.com/uralov/sms-counter-python)
2016-07-10 20:06:42 +00:00
**sms-counter-python** is a lib that help to count characters of SMS messages.
2016-07-10 20:06:42 +00:00
#### Get it now
```
$ pip install git+https://github.com/dedayoa/sms-counter-python.git#egg=sms_counter
```
#### Support
* Python 2
* Python 3
2016-07-10 20:12:52 +00:00
#### Requirements
sms-counter-python has no external dependencies outside of the Python standard library
#### Usage
2016-07-10 20:12:52 +00:00
```python
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'}
2016-07-10 20:12:52 +00:00
```
2016-07-10 20:06:42 +00:00
2020-08-27 23:14:29 +00:00
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
2016-07-10 20:06:42 +00:00
* Original idea : [danxexe/sms-counter](https://github.com/danxexe/sms-counter)
* Next Original : [wobblecode/sms-counter-php](https://github.com/wobblecode/sms-counter-php/)
#### License
MIT licensed. See the bundled [LICENSE](LICENSE) file for more details.