Python How to Send SMS via Short Message Peer-to-Peer using
smpplib
import smpplib
import settings
client = None
try:
client = smpplib.client.Client(settings.SMS_SYSTEM_HOSTNAME, settings.SMS_SYSTEM_PORT)
client.connect()
try:
client.bind_transmitter(system_id=settings.SMS_SYSTEM_ID, password=settings.SMS_SYSTEM_PASSWORD)
client.send_message(source_addr_ton=smpplib.consts.SMPP_TON_INTL,
source_addr='9535134654',
dest_addr_ton=smpplib.consts.SMPP_TON_INTL,
destination_addr='9535134654',
short_message='test Message`')
finally:
#print "==client.state====", client.state
if client.state in [smpplib.consts.SMPP_CLIENT_STATE_BOUND_TX]:
#if bound to transmitter
try:
client.unbind()
except smpplib.exceptions.UnknownCommandError as ex:
#https://github.com/podshumok/python-smpplib/issues/2
try:
client.unbind()
except smpplib.exceptions.PDUError as ex:
pass
finally:
if client:
#print "==client.state====", client.state
client.disconnect()
#print "==client.state====", client.state
Ref Sites
=======
https://github.com/podshumok/python-smpplib
http://messagetools.googlecode.com/svn/trunk/smppClient.py
http://messagetools.googlecode.com/svn/trunk/smpplib/test_client.py
www.nowsms.com/discus/messages/1/SMPP_v3_4_Issue1_2-24857.pdf
smpplib
import smpplib
import settings
client = None
try:
client = smpplib.client.Client(settings.SMS_SYSTEM_HOSTNAME, settings.SMS_SYSTEM_PORT)
client.connect()
try:
client.bind_transmitter(system_id=settings.SMS_SYSTEM_ID, password=settings.SMS_SYSTEM_PASSWORD)
client.send_message(source_addr_ton=smpplib.consts.SMPP_TON_INTL,
source_addr='9535134654',
dest_addr_ton=smpplib.consts.SMPP_TON_INTL,
destination_addr='9535134654',
short_message='test Message`')
finally:
#print "==client.state====", client.state
if client.state in [smpplib.consts.SMPP_CLIENT_STATE_BOUND_TX]:
#if bound to transmitter
try:
client.unbind()
except smpplib.exceptions.UnknownCommandError as ex:
#https://github.com/podshumok/python-smpplib/issues/2
try:
client.unbind()
except smpplib.exceptions.PDUError as ex:
pass
finally:
if client:
#print "==client.state====", client.state
client.disconnect()
#print "==client.state====", client.state
Ref Sites
=======
https://github.com/podshumok/python-smpplib
http://messagetools.googlecode.com/svn/trunk/smppClient.py
http://messagetools.googlecode.com/svn/trunk/smpplib/test_client.py
www.nowsms.com/discus/messages/1/SMPP_v3_4_Issue1_2-24857.pdf
there is an error of "No module named settings". Please tell me how to import this module.
ReplyDeletedont use settings file.., just directly enter the host, port no, id and pass in the code
ReplyDeleteHow to get id and password
Deleteneed to install any s/w
ReplyDelete$ python smpp.py
ReplyDelete==client.state==== 2
==client.state==== 2
==client.state==== 0
How can i fix this??
are you pass this problem ? i have too
Delete#python smpp.py
DeleteTraceback (most recent call last):
File "smpp.py", line 25, in
from smpplib import command, pdu
ImportError: No module named smpplib
bloger doing bulshit
no module named smpp. what do i do???
ReplyDeletehttps://pypi.org/project/python3-smpplib/#files
DeleteThis comment has been removed by the author.
DeleteHi, SMPP services are widely used to send a high volume of messages in a single click with best-in-class delivery. So, if you have huge SMS consumption that must get this services to get success in this competitive edge. SMPP Client Panel
ReplyDeletehow we can send sms to multiple numbers ?
ReplyDelete