GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ONTPNET/smpplib: SMPP library for Python

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

86 Commits
86 Commits

Folders and files

NameName
Last commit message
Last commit date
django_example
django_example
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
__init__.py
__init__.py
 
 
client.py
client.py
 
 
client_sync.py
client_sync.py
 
 
command.py
command.py
 
 
command_codes.py
command_codes.py
 
 
consts.py
consts.py
 
 
exceptions.py
exceptions.py
 
 
gsm.py
gsm.py
 
 
pdu.py
pdu.py
 
 
ptypes.py
ptypes.py
 
 
smpp.py
smpp.py
 
 
test.py
test.py
 
 

Repository files navigation

python-libsmpp

SMPP library for Python3 . Forked from github

Adopded for russian telecom providers and python3 Example:

# coding=utf8

import datetime
import pytz

import logging
import sys

import smpplib.gsm
import smpplib.client
import smpplib.consts

# if you want to know what's happening
logging.basicConfig(level='DEBUG')

client = smpplib.client.Client('123.456.789.101', 1123)


# Print when obtain message_id
# client.set_message_sent_handler(
#    lambda pdu: sys.stdout.write('sent {} {}\n'.format(pdu.sequence, pdu.message_id)))

def getPdu(pdu):
    print('Parsed pdu:', pdu.parsed)

client.set_message_received_handler(getPdu)

client.connect()
client.bind_transceiver(system_id='1234', password='5678')

parts, encoding_flag, msg_type_flag = smpplib.gsm.make_parts('Руский из питона 3, кодировочку зажги!\n')

for part in parts:
    pdu = client.send_message(

        source_addr_ton=smpplib.consts.SMPP_TON_NWSPEC,
        source_addr_npi=smpplib.consts.SMPP_NPI_ISDN,
        source_addr='1591',

        dest_addr_ton=smpplib.consts.SMPP_TON_NATNL,
        dest_addr_npi=smpplib.consts.SMPP_NPI_ISDN,
        # Make sure thease two params are byte strings, not unicode:
        destination_addr='79531498486',
        short_message=part,

        data_coding=encoding_flag,
        esm_class=msg_type_flag,
        registered_delivery=True,
    )
    print(pdu.sequence)

client.listen()

You also may want to listen in a thread:

from threading import Thread
t = Thread(target=client.listen)
t.start()

The client supports setting a custom generator that produces sequence numbers for the PDU packages. Per default a simple in memory generator is used which in conclusion is reset on (re)instantiation of the client, e.g. by an application restart. If you want to keep the sequence number to be persisted across restarts you can implement your own storage backed generator.

Example:

import smpplib.client

import mymodule

generator = mymodule.PersistentSequenceGenerator()
client = smpplib.client.Client('example.com', SOMEPORTNUMBER, sequence_generator=generator)
...

About

SMPP library for Python

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.