• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tropo.Tropo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: index

def index(request):
    s = Session(request.body)
    t = Tropo()
    t.say('12345', _as='DIGITS', voice='dave')
    json = t.RenderJson()
    print(json)
    return json
开发者ID:buildingspeak,项目名称:tropo-webapi-python,代码行数:7,代码来源:gh-14.test_say.py


示例2: do_confirm_ok

 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,代码行数:7,代码来源:vote.py


示例3: post

    def post(self, request):
        t = Tropo()
        r = Result(request.body)
        log.debug('PlayCode got: %s', request.body.__repr__())

        session = m.Session.objects.get(identifier=r._sessionId)
        player = session.player

        if r._state == 'DISCONNECTED':
            log.info('player %s disconnected', session.player)
            return HttpResponse(t.RenderJson())
            
        # see if there's a user-entered code
        try:
            code = r.getValue()
        except KeyError:
            t.say("Please try again.")
            code = None

        # if there's a code, try changing the station
        if code:
            try:
                song = m.SongStation.objects.get(select_code=code)
                player.completed_stations.add(song)
                player.current_station = song
                player.save()
            except ObjectDoesNotExist:
                t.say("Sorry, %s is invalid" % code)

        prompt_player(t, player)

        tropo_response = t.RenderJson()
        log.debug('PlayCode returning %s', tropo_response)
        return HttpResponse(tropo_response)
开发者ID:sporksmith,项目名称:dance_ave,代码行数:34,代码来源:views.py


示例4: index

def index(request):

	r = Result(request.body)        
        print "request.body : %s" % request.body

	t = Tropo()

	answer = r.getInterpretation()
	value = r.getValue()
        
	t.say("You said " + answer + ", which is a " + value)
        
        actions_options_array = ['name', 'attempts', 'disposition', 'confidence', 'interpretation', 'utterance', 'value', 'concept', 'xml', 'uploadStatus']
        actions = r.getActions()
	if (type (actions) is list):
	     for item in actions:
		for opt in actions_options_array:
                    print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % {'actionfieldname':opt, "vaalue":item.get(opt,'NoValue')}
                print '------------------------------'
             
       	else:
            dict = actions
	    for opt in actions_options_array:
                print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % {'actionfieldname':opt, "vaalue":dict.get(opt,'NoValue')}
        
        json = t.RenderJson()
        print json
	return json
开发者ID:tropo,项目名称:tropo-webapi-python,代码行数:28,代码来源:gh-20-test_ask.py


示例5: do_confirm_ok

 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,代码行数:7,代码来源:voting_webapi.py


示例6: index

def index(request):
    t = Tropo()
    t.answer(headers={"P-Header":"value goes here","Remote-Party-ID":"\"John Doe\"<sip:[email protected]>;party=calling;id-type=subscriber;privacy=full;screen=yes"})
    t.say('This is your mother. Did you brush your teeth today?')
    json = t.RenderJson() 
    print json
    return json
开发者ID:tropo,项目名称:tropo-webapi-python,代码行数:7,代码来源:test_answer.py


示例7: setup_tropo

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,代码行数:7,代码来源:dscc.py


示例8: ivr_in

def ivr_in(request):
    """
    Handles tropo call requests
    """
    if request.method == "POST":
        data = json.loads(request.body)
        phone_number = data["session"]["from"]["id"]
        # TODO: Implement tropo as an ivr backend. In the meantime, just log the call.

        if phone_number:
            cleaned_number = strip_plus(phone_number)
            v = VerifiedNumber.by_extensive_search(cleaned_number)
        else:
            v = None

        # Save the call entry
        msg = CallLog(
            phone_number=cleaned_number,
            direction=INCOMING,
            date=datetime.utcnow(),
            backend_api=SQLTropoBackend.get_api_id(),
        )
        if v is not None:
            msg.domain = v.domain
            msg.couch_recipient_doc_type = v.owner_doc_type
            msg.couch_recipient = v.owner_id
        msg.save()

        t = Tropo()
        t.reject()
        return HttpResponse(t.RenderJson())
    else:
        return HttpResponseBadRequest("Bad Request")
开发者ID:philipkaare,项目名称:commcare-hq,代码行数:33,代码来源:views.py


示例9: verify_no

def verify_no(request):
	t = Tropo()
	t.say("Sorry, that wasn't on of the options.")
	json = t.RenderJson()
	print json
	return HttpResponse(json)
	
开发者ID:kwantopia,项目名称:shoppley-migrate,代码行数:6,代码来源:views.py


示例10: index

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,代码行数:7,代码来源:OutboundSMS.py


示例11: index

def index(request):
	
	t = Tropo()
	t.call("+xxx")
	t.record(name = "recording", timeout = 10, maxSilence = 7, maxTime = 60, choices = {"terminator": "#"}, transcription = {"id":"1234", "url":"mailto:[email protected]", "language":"de_DE"}, say = {"value":"Willkommen zur Abfage! Sag uns bitte, wie es dir geht!"}, url = "http://www.example.com/recordings.py", voice =" Katrin")
	
	return t.RenderJson()
开发者ID:esinfaik,项目名称:tropo-webapi-python,代码行数:7,代码来源:record_transcription_language.py


示例12: index

def index(request):
    s = Session(request.body)
    t = Tropo()
    t.call(to=' ' + TO_NUMBER, _from=' ' + FROM_NUMBER, label='xiangwyujianghu', voice='Tian-tian', callbackUrl='http://192.168.26.88:8080/FileUpload/receiveJson', promptLogSecurity='suppress')
    t.say('This is your mother. Did you brush your teeth today?')
    json = t.RenderJson() 
    print json
    return json
开发者ID:tropo,项目名称:tropo-webapi-python,代码行数:8,代码来源:gh-14.test_call.py


示例13: index

def index(request):

    t = Tropo()
    VOICE = 'Grace' 

    t.record(name='voicemail.mp3', say='Your call is important. Please leave a short message after the tone: ', url = 'http://www.example.com', beep = True, format = 'audio/mp3', voice = VOICE) 

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


示例14: index

def index(request):
    s = Session(request.body)
    t = Tropo()
    t.call(to='tel:+' + TO_NUMBER, _from='tel:+' + FROM_NUMBER)
    t.say('This is your mother. Did you brush your teeth today?')
    json = t.RenderJson()
    print(json)
    return json
开发者ID:buildingspeak,项目名称:tropo-webapi-python,代码行数:8,代码来源:gh-14.test_call.py


示例15: index

def index(request):

	t = Tropo()

	t.call(to="+17326820887", network = "SMS")
	t.say("Tag, you're it!")
	
	return t.RenderJson()
开发者ID:choogiesaur,项目名称:internship-stuff-2k15,代码行数:8,代码来源:test.py


示例16: index

def index(request):
    #s = Session(request.body)
    t = Tropo()
    t.call(to=' ' + TO_NUMBER, _from=' ' + FROM_NUMBER, label='xiangwyujianghu', network = 'MMS')
    mediaa = ['http://www.gstatic.com/webp/gallery/1.jpg', 'macbook eclipse', 'http://artifacts.voxeolabs.net.s3.amazonaws.com/test/test.png', 1234567890, '0987654321', 'https://www.travelchinaguide.com/images/photogallery/2012/beijing-tiananmen-tower.jpg']
    t.say('This is your mother. Did you brush your teeth today?', media = mediaa)
    json = t.RenderJson() 
    print json
    return json
开发者ID:tropo,项目名称:tropo-webapi-python,代码行数:9,代码来源:gh-14.test_call_MMS.py


示例17: index

def index(request):
    t = Tropo()

    # s = Session(request.get_json(force=True))
    sys.stderr.write(str(request.body) + "\n")

    s = Session(request.body)
    message = s.initialText
    # print("Initial Text: " + initialText)

    # Check if message contains word "results" and if so send results
    if not message:
        # number = s["session"]["parameters"]["numberToDial"]
        number = s.parameters["numberToDial"]
        reply = "Would you like to vote?"
        t.call(to=number, network="SMS")
        # t.say(reply)

    elif message.lower().find("results") > -1:
        results = get_results()
        reply = ["The current standings are"]
        for i, result in enumerate(results):
            if i == 0:
                reply.append("  *** %s is in the lead with %s percent of the votes.\n" % (result[0], str(round(result[2]))))
            elif i <= 3:
                reply.append("  -   %s has %s percent of the votes.\n" % (result[0], str(round(result[2]))))
    # Check if message contains word "options" and if so send options
    elif message.lower().find("options") > -1:
        options = get_options()
        reply = ["The options are..."]
        msg = ""
        for option in options:
            msg += "%s, " % (option)
        msg = msg[:-2] + ""
        reply.append(msg)
    # Check if message contains word "vote" and if so start a voting session
    elif message.lower().find("vote") > -1:
        # reply = "Let's vote!  Look for a new message from me so you can place a secure vote!"
        reply = [process_incoming_message(message)]
    # If nothing matches, send instructions
    else:
        # Reply back to message
        # reply = "Hello, welcome to the MyHero Demo Room.\n" \
        #         "To find out current status of voting, ask 'What are the results?'\n" \
        #         "To find out the possible options, ask 'What are the options?\n" \
        #         '''To place a vote, simply type the name of your favorite Super Hero and the word "vote".'''
        reply = ["Hello, welcome to the MyHero Demo Room." ,
                "To find out current status of voting, ask 'What are the results?'",
                "To find out the possible options, ask 'What are the options?",
                '''To place a vote, simply type the name of your favorite Super Hero and the word "vote".''']

    # t.say(["Really, it's that easy." + message])
    t.say(reply)
    response = t.RenderJson()
    sys.stderr.write(response + "\n")
    return response
开发者ID:hpreston,项目名称:myhero_tropo,代码行数:56,代码来源:myhero_tropo.py


示例18: hello

def hello(request): 
  t = Tropo()
  #This is the initial text that you want
  msg = request.POST['msg'] 
  #This sends a text reply back
  json = t.say("you just said: " + msg) 
  #This renders the reply into JSON so Tropo can read it
  json = t.RenderJson(json) 
  #This sends the JSON to Tropo
  return HttpResponse(json) 
开发者ID:kevinbond,项目名称:mysite,代码行数:10,代码来源:views.py


示例19: index

def index(request):

  r = Result(request.body)
  t = Tropo()

  userType = r.getUserType()

  t.say("You are a " + userType)

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


示例20: continue_conversation

def continue_conversation(user_id, topics, choice):
    if choice in topics:
        response = "You asked for %s: %s" % (topics[choice]["title"], topics[choice]["text"])
    else:
        clear_conversation(user_id)
        return start_conversation(user_id, choice)

    phone = Tropo()
    phone.say(response)
    return (phone.RenderJson(), 200, {"content-type": "application/json"})
开发者ID:mjumbewu,项目名称:wikirights,代码行数:10,代码来源:app.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python troposphere.Template类代码示例发布时间:2022-05-27
下一篇:
Python timeutils.DateArithmetic类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap