forked from gecko-landmarks/smspdu
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPKG-INFO
130 lines (101 loc) · 4.88 KB
/
PKG-INFO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
Metadata-Version: 1.0
Name: smspdu
Version: 1.0
Summary: SMS PDU encoding and decoding, including GSM-0338 character set
Home-page: http://pypi.python.org/pypi/smspdu
Author: Richard Jones
Author-email: [email protected]
License: UNKNOWN
Description: SMS PDU encoding and decoding, including GSM-0338 character set.
Overview
--------
This library handles SMS-DELIVER and SMS-SUBMIT format PDUs, and includes
full support for all data formats, flags and headers, and round-trips from
PDU to object and back again.
It also includes convenience APIs for constructing new PDUs from text or
data.
This library is very mature - it's been in production use for many years
before the 1.0 release was made. It's also, as far as I'm aware, the most
complete SMS PDU encoding and decoding library available.
The T39 functionality has been copied from the previous PyPI package with
the same name as this library to provide some continuity. It is untested.
PDU Interface
-------------
Typical usage will involve the SMS_SUBMIT and SMS_DELIVER .fromPDU(),
.toPDU() and .create() methods:
>>> from smspdu import SMS_SUBMIT
>>> pdu = SMS_SUBMIT.create('sender', 'recipient', 'hello, world')
>>> pdu.toPDU()
'010010D0F2F2380D4F97DD7400000CE8329BFD6681EE6F399B0C'
>>> pdu = smspdu.SMS_SUBMIT.fromPDU(_, 'sender')
>>> pdu.user_data
u'hello, world'
Command-line Usage
------------------
To decode a PDU on the command-line (using python2.7+), use::
% python -m smspdu 010010D0F2F2380D4F97DD7400000CE8329BFD6681EE6F399B0C
010010D0F2F2380D4F97DD7400000CE8329BFD6681EE6F399B0C
tp_mti = 1 (SMS-SUBMIT)
sender = unknown
tp_rd = 0
tp_vpf = 0
tp_vp = None
tp_rp = 0
tp_udhi = 0
tp_srr = 0
tp_mr = 0
tp_al = 16
tp_toa = d0 (Alphanumeric; Unknown)
(recipient) address = 'recipient'
tp_pid = 0x00 (Normal Case)
tp_dcs = 0x00 (Immedate Display, GSM-0338 Default Alphabet)
tp_udl = 12
tp_ud = '\xe82\x9b\xfdf\x81\xeeo9\x9b\x0c'
datestamp = 11062712173200
user_data = u'hello, world'
user_data_headers = []
The first line re-displays the PDU with the various sections colourised.
Users of versions of Python 2.6 will need to run "python -m smspdu.pdu".
SMS Text - Handling the Awesomeness of GSM 0338
------------------------------------------------
First the basics; encoding some text:
>>> from smspdu import gsm0338
>>> c = gsm0338()
>>> gsm_message = c.encode(u'test message')
And decoding that message:
>>> from smspdu import gsm0338
>>> c = gsm0338()
>>> c.decode(gsm_message)
u'test message'
The library also provides some functions for making text SMS-happy:
:func:`gsm0338_safe`
A simplistic function which just replaces any characters in the unicode
input. You should probably use :func:`attempt_encoding` instead since it
tries to make the message appear the same.
:func:`attempt_encoding`
Attempt to encode the supplied text for SMS transmission in a single
message. This will alter the message to replace accents and typography
where necessary to reduce the per-character septet count.
:func:`remove_accent`
Used by :func:`attempt_encoding` to remove all accents from characters in
the supplied text.
:func:`remove_typography`
Used by :func:`attempt_encoding` to replaced typograpically-correct
punctuation with simplified GSM-0338 characters.
:func:`decode_ascii_safe`
Removes all non-printable, non-ASCII codes in the string.
:func:`smpp_to_sms_data_coding`
Attempt to convert the SMPP data coding scheme (SMPP v34) to a useful
SMS PDU (GSM 03.38) data coding scheme.
Version History (in Brief)
--------------------------
- 1.0 the initial release based on mature internal ekit.com code
----
This code is copyright 2011 eKit.com Inc (http://www.ekit.com/)
See the end of the source file for the license of use.
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: BSD License