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


Python Tropo.on方法代码示例

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


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

示例1: index

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
 def index(self):
     t = Tropo()
     t.say("Welcome to Pitchlift")
     choices = Choices(self.choices())
     t.ask(choices, say=self.prompt())
     t.on(event="continue", next="/menu/cont")
     return t.RenderJson()
开发者ID:evelynmitchell,项目名称:dexy-site,代码行数:9,代码来源:pitchlift2.py

示例2: license

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
def license(request):
    r = Result(request.body)
    t = Tropo()

    answer = r.getInterpretation()

    u = current[r._sessionId]
    current[r._sessionId]["last_name"] = answer

    db = MySQLdb.connect(host="localhost", user="globalhackv", passwd="globalhack", db="globalhackv")
    cur = db.cursor()

    cur.execute(
        "SELECT first_name, last_name FROM good_data_fixed WHERE date_of_birth = %s AND last_name LIKE %s AND status <> 'CLOSED' AND status <> 'DISMISS WITHOUT COSTS'",
        (u["birthday"], answer),
    )
    result = cur.fetchall()

    cur.close()
    db.close()

    t.say("Hello %s %s," % (result[0][0], result[0][1]))

    choices = Choices("[4 DIGITS]", mode="dtmf", attempts=3)
    t.ask(
        choices,
        timeout=15,
        name="last_drivers",
        say="As a final validation, please enter the last four digits of your driver's license I D",
    )

    t.on(event="continue", next="/results")

    return t.RenderJson()
开发者ID:ixchi,项目名称:GlobalHackV,代码行数:36,代码来源:phone.py

示例3: setup_tropo

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
def setup_tropo():

    tropo_core = Tropo()
    tropo_core.on(event='hangup', next=url_for('handle_hangup'))
    tropo_core.on(event='error', next=url_for('handle_error'))

    return tropo_core
开发者ID:sibblegp,项目名称:DSCC,代码行数:9,代码来源:dscc.py

示例4: do_pitch

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
    def do_pitch(self):
        pitch_id = self.generate_pitch_id()
        pitch_pin = self.generate_pitch_pin()
        pitch_key = self.generate_pitch_key()

        pitch.new_pitch(pitch_id, pitch_pin, pitch_key, "pending")

        ### @export "recording-instructions"
        t = Tropo()
        t.say("You will soon be prompted to record your elevator pitch")
        t.say("Please have pen and paper ready")
        t.say("Please start making your pitch when you hear the beep")

        ### @export "make-recording"
        t_url = "http://50.17.37.57:8081/transcription/%s" % pitch_key
        t.record(
            beep = True,
            choices = '#',
            maxTime = 120,
            say = """Press pound when finished
            to listen to your recording.""",
            silenceTimeout = 7,
            timeout = 10,
            transcription = {
              "url" : t_url
            },
            url = "http://50.17.37.57:8081/record/%s" % pitch_key
            )

        ### @export "finish"
        t.on(event="continue", next="/record/after/%s" % pitch_id)
        return t.RenderJson()
开发者ID:evelynmitchell,项目名称:dexy-site,代码行数:34,代码来源:pitchlift2.py

示例5: index

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
def index(request):
	t = Tropo()
	t.ask(choices = "yes(yes,y,1), no(no,n,2)", timeout=60, name="reminder", say = "Hey, did you remember to take your pills?")	
	t.on(event = "continue", next ="/continue")
	t.on(event = "incomplete", next ="/incomplete")
	json = t.RenderJson()
	print(json)
	return json
开发者ID:buildingspeak,项目名称:tropo-webapi-python,代码行数:10,代码来源:gh-17.test.py

示例6: index

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
def index(request):
	t = Tropo()
	t.call(to = "[email protected]", _from = "[email protected]", channel = "TEXT", network = "JABBER")
	t.ask(choices = "yes(yes,y,1), no(no,n,2)", timeout=60, name="reminder", say = "Hey, did you remember to take your pills?")	
	t.on(event = "continue", next ="verify_yes")
	t.on(event = "incomplete", next ="verify_no")
	json = t.RenderJson()
	print json
	return HttpResponse(json)
开发者ID:kwantopia,项目名称:shoppley-migrate,代码行数:11,代码来源:views.py

示例7: index

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
def index(request):

  t = Tropo()

  mc = MachineDetection(introduction="This is a test. Please hold while I determine if you are a Machine or Human. Processing. Finished. THank you for your patience.", voice="Victor").json
  t.call(to="+14071234321", machineDetection=mc)
  
  t.on(event="continue", next="/continue.json")

  return t.RenderJson()
开发者ID:DJF3,项目名称:tropo-webapi-python,代码行数:12,代码来源:tropoTestMachineDetection.py

示例8: index

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
def index(request):

	t = Tropo()

	t.ask(choices = "yes(yes,y,1), no(no,n,2)", timeout = 15, name = "directory", minConfidence = 1, attempts = 3, say = "Are you trying to reach the sales department??")

	t.on(event = "continue", next ="/continue")

        json = t.RenderJson()

        print(json)
	return json
开发者ID:buildingspeak,项目名称:tropo-webapi-python,代码行数:14,代码来源:gh-20-test_ask.py

示例9: do_listen

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
    def do_listen(self):
        prompt = """
        If you know the five digit pitch eye dee
        you want to listen to, please enter it now.
        If you want to hear a random pitch,
        press zero or say random"""

        t = Tropo()
        choices = Choices("0, random, [5 DIGITS]")
        t.ask(choices, say=prompt)
        t.on(event="continue", next="/listen")
        return t.RenderJson()
开发者ID:evelynmitchell,项目名称:dexy-site,代码行数:14,代码来源:pitchlift2.py

示例10: index

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
def index(request):

	t = Tropo()

        choices = Choices("[4-5 DIGITS]", mode="dtmf", terminator = "#")
	t.ask(choices, timeout=15, name="digit", say = "What's your four or five digit pin? Press pound when finished.")

	t.on(event = "continue", next ="/continue")

        json = t.RenderJson()

        print json
	return json
开发者ID:BSierakowski,项目名称:tropo-webapi-python,代码行数:15,代码来源:gh-21.choices.py

示例11: do_response

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
    def do_response(self):
        answer = self.get_answer()
        candidate = models.find_candidate_by_code(answer)

        if not candidate:
            return self.do_bad_choice()
        else:
            t = Tropo()
            prompt = "You chose %s, is that correct? " % candidate['name']
            choices = self.confirm_choices()
            t.ask(choices, say=prompt + self.confirm_prompt())
            t.on(event="continue", next=self.confirm_url(candidate['id']))
            return t.RenderJson()
开发者ID:ananelson,项目名称:tropo-vote,代码行数:15,代码来源:vote.py

示例12: do_response

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
    def do_response(self):
        song_id = self.get_answer()
        song_title = models.songs.song_title(song_id)

        if not song_id:
            return self.do_bad_choice()
        else:
            t = Tropo()
            prompt = "You chose %s, is that correct? " % song_title
            choices = self.confirm_choices()
            t.ask(choices, say=prompt + self.confirm_prompt())
            t.on(event="continue", next=self.confirm_url(song_id))
            return t.RenderJson()
开发者ID:imclab,项目名称:tropo-voting-app,代码行数:15,代码来源:voting_webapi.py

示例13: do_menu

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
    def do_menu(self):
        t = Tropo()
        prompt = """
        You will shortly be prompted to enter the two digit code for the
        company you want to vote for.  If you already know the code, you can
        enter it at any time using your phone's keypad.
        """
        for candidate in models.get_candidates():
            prompt += "For %s, enter %s. " % (candidate['name'], candidate['vote_code'])

        t.ask(Choices("[2 DIGITS]", mode="dtmf"), say=prompt)
        t.on(event="continue", next=self.response_url())
        return t.RenderJson()
开发者ID:ananelson,项目名称:tropo-vote,代码行数:15,代码来源:vote.py

示例14: do_menu

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
    def do_menu(self):
        t = Tropo()
        t.say("hello, thank you for helping us choose the music")

        prompts = []
        choices = []
        for title, keyword, number, votes_cache in models.songs.songs_array():
            choices.append("%s(%s,%s)" % (number, keyword, number))
            prompts.append("For %(title)s, say %(keyword)s or press %(number)s." % locals())
        prompt = " ".join(prompts)

        t.ask(Choices(",".join(choices)), say=prompt)
        t.on(event="continue", next=self.response_url())
        return t.RenderJson()
开发者ID:imclab,项目名称:tropo-voting-app,代码行数:16,代码来源:voting_webapi.py

示例15: birthday_day

# 需要导入模块: from tropo import Tropo [as 别名]
# 或者: from tropo.Tropo import on [as 别名]
def birthday_day(request):
    r = Result(request.body)
    t = Tropo()

    answer = r.getInterpretation()

    current[r._sessionId]["birthday"]["month"] = answer

    choices = Choices("[1-2 DIGITS]", mode="dtmf")
    t.ask(choices, timeout=15, name="birthday_day", say="Please enter your date of birth", attempts=3)

    t.on(event="continue", next="/name")

    return t.RenderJson()
开发者ID:ixchi,项目名称:GlobalHackV,代码行数:16,代码来源:phone.py


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