This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project 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:

gsm0338_safe
A simplistic function which just replaces any characters in the unicode input. You should probably use attempt_encoding instead since it tries to make the message appear the same.
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.
remove_accent
Used by attempt_encoding to remove all accents from characters in the supplied text.
remove_typography
Used by attempt_encoding to replaced typograpically-correct punctuation with simplified GSM-0338 characters.
decode_ascii_safe
Removes all non-printable, non-ASCII codes in the string.
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.

Release History

Release History

1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
smspdu-1.0.tar.gz (28.2 kB) Copy SHA256 Checksum SHA256 Source Jun 27, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting