This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
phone:gammu_send_sms [2011/06/07 09:51] flozz [Send SMS using Python] Minimal code |
phone:gammu_send_sms [2017/09/01 12:24] (current) |
||
---|---|---|---|
Line 27: | Line 27: | ||
import gammu | import gammu | ||
+ | |||
+ | |||
+ | SMS = { | ||
+ | 'Class': 1, #SMS Class | ||
+ | 'Text': "Hello World from Python", #Message | ||
+ | 'SMSC': {'Location': 1}, | ||
+ | 'Number': "+336xxxxxxxx", #The phone number | ||
+ | } | ||
gamu_sm = gammu.StateMachine() | gamu_sm = gammu.StateMachine() | ||
- | gamu_sm.ReadConfig() | + | gamu_sm.ReadConfig() #Read the default config file (~/.gammurc) |
- | gamu_sm.Init() | + | gamu_sm.Init() #Connect to the phone |
- | gamu_sm.SendSMS({ | + | gamu_sm.SendSMS(SMS) #Send the SMS |
- | 'Class': 1, | + | |
- | 'Text': "Hello World from my Python script :)", | + | |
- | 'SMSC': {'Location': 1}, | + | |
- | 'Number': "+336xxxxxxxx", | + | |
- | }) | + | |
</code> | </code> |