2013-12-15 3 views
0

안녕하세요. 도움을 주셔서 감사합니다. 나는 현재 다음 코드Gammu Python SendSMS 함수를 반환하는 방법 보낸 상태?

#!/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 함수 반환 값의 결과입니다.

미리 답변 해 주셔서 감사합니다.

답변

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'