0

您好,感谢您抽出宝贵时间提供帮助。

我目前正在使用以下代码

#!/usr/bin/env python
# Sample script to show how to send SMS

import gammu
import sys


sm = gammu.StateMachine()
sm.ReadConfig()
sm.Init()

message = {
    'Text': 'python-gammu testing message',
    'SMSC': {'Location': 1},
    'Number': '+584126555508',
}

# Actually send the message
sm.SendSMS(message)

它工作正常,但我怎么能确定 SendSMS 功能真的发送了消息......

例如:sendSMS 函数返回值作为已发送、未发送结果。

提前感谢您的回答。

4

1 回答 1

1
try:
  # Send SMS if all is OK
  sm.SendSMS(message)
  print 'Success, SMS was Sent'

except gammu.GSMError:
    # Show error if message not sent
    print 'Error, SMS not Sent'
于 2014-01-04T14:27:59.200 回答