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


Python tropo.Tropo类代码示例

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


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


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