当前位置: 首页>>代码示例>>Python>>正文


Python Tropo.message方法代码示例

本文整理汇总了Python中tropo.Tropo.message方法的典型用法代码示例。如果您正苦于以下问题:Python Tropo.message方法的具体用法?Python Tropo.message怎么用?Python Tropo.message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tropo.Tropo的用法示例。


在下文中一共展示了Tropo.message方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_confirm_ok

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
 def do_confirm_ok(self, song_id):
     caller_id = models.votes.caller_id_if_valid(self.call_id())
     models.votes.vote_for_song(song_id, caller_id)
     t = Tropo()
     t.say("Great, your vote has been counted. Goodbye.")
     t.message("Thanks for voting!", channel="TEXT", to=caller_id)
     return t.RenderJson()
开发者ID:imclab,项目名称:tropo-voting-app,代码行数:9,代码来源:voting_webapi.py

示例2: do_text

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
 def do_text(self):
     caller_id = models.caller_id_if_valid(self.call_id())
     if models.caller_id_can_vote(caller_id):
         session_info = json.loads(web.data())['session']
         msg = session_info['initialText']
         m = re.match("^(v|V|vote|VOTE)\s+([0-9]{2})$", msg)
         if m:
             vote_code = m.groups()[1]
             candidate = models.find_candidate_by_code(vote_code)
             if candidate:
                 models.record_vote(caller_id, candidate['id'])
                 t = Tropo()
                 t.message(
                         "You have voted for %s as most disruptive startup. Thanks for voting! Tropo <3s you!" % candidate['name'],
                         to=caller_id, channel='TEXT')
                 return t.RenderJson()
             else:
                 return self.do_help_text("Sorry, there's no candidate %s. " % vote_code)
         else:
             return self.do_help_text("Sorry, we didn't understand your text message. ")
     elif not caller_id:
         return self.do_help_text("You need to have caller ID enabled to vote.")
     else:
         t = Tropo()
         t.message("Oops, it looks like you have voted already.", to=caller_id, channel='TEXT')
         return t.RenderJson()
开发者ID:ananelson,项目名称:tropo-vote,代码行数:28,代码来源:vote.py

示例3: index

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
def index(request):
    currenttime = datetime.datetime.now()
    t = Tropo()
    sayobjOutbound = "Now is " + str(currenttime)
    t.message(sayobjOutbound, to="+1 725-419-2113", network="SMS")
    print t.RenderJson()
    return t.RenderJson()
开发者ID:tropo,项目名称:tropo-webapi-python,代码行数:9,代码来源:OutboundSMS.py

示例4: do_confirm_ok

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
 def do_confirm_ok(self, candidate_id):
     caller_id = models.caller_id_if_valid(self.call_id())
     models.record_vote(caller_id, candidate_id)
     t = Tropo()
     t.say("Great, your vote has been counted. Goodbye.")
     t.message("Thanks for voting! Tropo <3 you!", channel="TEXT", to=caller_id)
     return t.RenderJson()
开发者ID:ananelson,项目名称:tropo-vote,代码行数:9,代码来源:vote.py

示例5: test_message

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
    def test_message(self):
        """
        Test the "message" Tropo class method.
        """

        tropo = Tropo()
        tropo.message("Hello World", self.MY_PHONE, channel='TEXT', network='SMS', timeout=5)
        rendered = tropo.RenderJson()
        pretty_rendered = tropo.RenderJson(pretty=True)
        print "===============test_message================="
        print "render json: %s" % pretty_rendered

        # print "test_message: %s" % tropo.RenderJson()
        rendered_obj = jsonlib.loads(rendered)
        wanted_json = ' {"tropo": [{"message": {"to": "%s", "say": {"value": "Hello World"}, "network": "SMS", "timeout": 5, "channel": "TEXT"}}]}' % self.MY_PHONE
        wanted_obj = jsonlib.loads(wanted_json)
        self.assertEqual(rendered_obj, wanted_obj)
开发者ID:JustinDupree,项目名称:tropo-webapi-python,代码行数:19,代码来源:test.py

示例6: handle_request

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
    def handle_request(self, request):
	if request.method != 'POST':
		return HttpResponse('Not a post!')
        self.debug('This is the tropo Request (raw): %s' % request.raw_post_data)
	s = Session(request.raw_post_data)
	if not s.callId:
                t = Tropo()
                t.message(s.parameters['msg'], to="tel:+%s" %  s.parameters['numberToDial'], network="SMS")
                return HttpResponse(t.RenderJson())
	else:
	        message = self.message(request.POST)
        	if message:
            		self.route(message)

	        t = Tropo()
        	t.hangup()
	        return HttpResponse(t.RenderJson())
开发者ID:hartfordr,项目名称:rapidsms-core-dev,代码行数:19,代码来源:tropobackend.py

示例7: do_happy

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
    def do_happy(self, pitch_id):
        t = Tropo()
        pitch.confirm_pitch(pitch_id)
        t.say("Great, your pitch has been saved.")

        p = pitch.get_pitch(pitch_id)

        ### @export "send-info-sms"
        call_id = json.loads(web.data())['result']['callId']
        session = pitch.session_info(call_id)

        is_sip = session['caller_network'] == 'SIP'
        is_number = re.match("^(\+)?[0-9]+$", session['caller_id'])

        if is_sip and is_number:
            t.message(
                    """Thank you for using pitchlift!
                    Your Pitch ID is %s.
                    Your PIN is %s.""" % (pitch_id, p['pin']),
                    to=session['caller_id'],
                    channel='TEXT'
                    )

        ### @export "say-info-aloud"
        t.say("Your pitch eye dee is")
        for c in pitch_id:
            t.say(c)
        t.say("Your pin is")
        for c in "%s" % p['pin']:
            t.say(c)
        t.say("once again")
        t.say("Your pitch eye dee is")
        for c in pitch_id:
            t.say(c)
        t.say("Your pin is")
        for c in "%s" % p['pin']:
            t.say(c)

        ### @export "finish"
        t.on(event="continue", next=self.MAIN_MENU)
        return t.RenderJson()
开发者ID:evelynmitchell,项目名称:dexy-site,代码行数:43,代码来源:pitchlift2.py

示例8: do_help_text

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
 def do_help_text(self, msg=""):
     caller_id = models.caller_id_if_valid(self.call_id())
     t = Tropo()
     say = "%sPhone this number back to use the voice interface or visit disrupt.pitchlift.org for help." % msg
     t.message(say, to=caller_id, channel="TEXT")
     return t.RenderJson()
开发者ID:ananelson,项目名称:tropo-vote,代码行数:8,代码来源:vote.py

示例9: Tropo

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
from tropo import Tropo
TO_NUMBER = ‘+19564664765’
t = Tropo()
t.message(“Your one time token is” + random.randint(1000,9999),TO_NUMBER,channel=“TEXT”,network=“SMS")
json = t.RenderJson()
开发者ID:eduardojm1293,项目名称:-2factor,代码行数:7,代码来源:2factor.py

示例10: index

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
def index(request):
    t = Tropo()
    t.message("Hello World", TO_NUMBER, channel="VOICE", _from="tel:+" + FROM_NUMBER)
    json = t.RenderJson()
    print json
    return json
开发者ID:smartfoundry,项目名称:smartfoundry-webapi-python,代码行数:8,代码来源:gh-14.test_message.py

示例11: index

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
def index(request):
        t = Tropo()
        t.message("Hello World", TO_NUMBER, channel='VOICE', _from='tel:+' + FROM_NUMBER)
	json = t.RenderJson()
	print(json)
	return json
开发者ID:buildingspeak,项目名称:tropo-webapi-python,代码行数:8,代码来源:gh-14.test_message.py

示例12: Tropo

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import message [as 别名]
        TO = "8005551212"

        ID = "foo"
        URL = "http://s3.amazonaws.com/xxx_s3_bucket/hello.wav"



        tropo = Tropo()

        tropo.ask("[5 digits]",
                  say = Say("Please enter a 5 digit zip code").json)

        tropo.call (TO)
        tropo.conference(ID)
        tropo.hangup()
        tropo.message ("Hello, World", TO)
        tropo.on(event="continue", 
             next="http://example.com/weather.py",
             say="Please hold.")

        tropo.record(say="Please say something for posterity", 
                     url=URL, 
                     choices = Choices("", terminator="#").json)
        tropo.redirect(ID)
        tropo.reject(ID)
        tropo.startRecording(URL)
        tropo.stopRecording()
        tropo.transfer(TO)

        tropo.message("Hello, World",
                      TO, 
开发者ID:JustinDupree,项目名称:tropo-webapi-python,代码行数:33,代码来源:test.py


注:本文中的tropo.Tropo.message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。