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
| import gammu
import sys
sm = gammu.StateMachine() # Read ~/.gammurc
sm.ReadConfig()
try:
sm.Init()
netinfo = sm.GetNetworkInfo()
print 'Network name: %s' % netinfo['NetworkName']
print 'Network code: %s' % netinfo['NetworkCode']
print 'LAC: %s' % netinfo['LAC']
print 'CID: %s' % netinfo['CID']
# Prepare message data
# We tell that we want to use first SMSC number stored in phone
phone_number = raw_input('Enter Phone Number:\n').decode('utf-8')
message = raw_input('Enter text:\n').decode('utf-8')
message = {
'Text': message,
'SMSC': {'Location': 1},
'Number': phone_number,
'Coding': 'Unicode_No_Compression',
}
# Actually send the message
sm.SendSMS(message)
except Exception,e:
print e
|