使用Python SMPP传入SMS

时间:2013-03-28 13:28:02

标签: python sms-gateway smpp

我是使用SMPP的新手。我不太确定收到的消息是否有效。我在Python 2.7中使用smpplib实现了这一点。我能够连接到SMPP服务并使用bind_transmitter发送短信。

在示例中有一个函数调用recv_handler,但我没有看到它调用任何地方。这是功能:

    def recv_handler(self, **args):
        print 'Message received:', args

任何帮助都会很棒。谢谢。

1 个答案:

答案 0 :(得分:0)

Megan from Twilio here.

I know this question is a bit old. But for someone who lands here looking how to deal with incoming SMS you can get started quickly here:

from flask import Flask, request, redirect
import twilio.twiml

app = Flask(__name__)

@app.route("/", methods=['GET', 'POST'])
def hello_monkey():

    resp = twilio.twiml.Response()
    resp.message("Hello, Mobile Monkey")
    return str(resp)

if __name__ == "__main__":
    app.run(debug=True)

Hope this helps!