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


Python Response.reject方法代码示例

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


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

示例1: test_blacklist_works

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import reject [as 别名]
 def test_blacklist_works(self):
     debug_orig = settings.DEBUG
     settings.DEBUG = False
     request = self.factory.post(self.str_uri, {'From': '+13333333333'},
             HTTP_X_TWILIO_SIGNATURE=self.str_signature_with_from_field_blacklisted_caller)
     response = str_view(request)
     r = Response()
     r.reject()
     self.assertEquals(response.content, str(r))
     settings.DEBUG = True
     request = self.factory.post(self.str_uri, {'From': '+13333333333'},
             HTTP_X_TWILIO_SIGNATURE=self.str_signature_with_from_field_blacklisted_caller)
     response = str_view(request)
     r = Response()
     r.reject()
     self.assertEquals(response.content, str(r))
     settings.DEBUG = debug_orig
开发者ID:BantouTelecom,项目名称:django-twilio,代码行数:19,代码来源:decorators.py

示例2: get_blacklisted_response

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import reject [as 别名]
def get_blacklisted_response(request):
    """Analyze the incoming Twilio request to determine whether or not to
    reject services. We'll only reject services if the user requesting service
    is on our blacklist.

    :param obj request: The Django HttpRequest object to analyze.
    :rtype: HttpResponse.
    :returns: HttpResponse if the user requesting services is blacklisted, None
        otherwise.
    """
    try:
        caller = Caller.objects.get(phone_number=request.REQUEST['From'])
        if caller.blacklisted:
            r = Response()
            r.reject()
            return HttpResponse(str(r), content_type='application/xml')
    except Exception, e:
        pass
开发者ID:godshall,项目名称:django-twilio,代码行数:20,代码来源:utils.py

示例3: voice

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import reject [as 别名]
def voice(request):
    r = Response()
    #subObj = sub_exist("PoopFactz")
    #msgObj = next_message(subObj, update=False)
    
    #r.say(msgObj.message)
    #if msgObj.follow_up != None:
    #    r.pause(length=2)
    #    r.say(msgObj.follow_up)
    #r.pause(length=2)
    #r.say("Thank you for calling Poop Facts. To subscribe for daily text message go to www dot Poop Facts dot com.")
    #r.pause(length=1)
    #r.say("That's Poop Facts with a zee")
    
    # To do:
    ## Have the caller press 1 to subscribe to PoopFactz
    
    r.reject()
    return r
开发者ID:bcorwin,项目名称:MsgSender,代码行数:21,代码来源:views.py

示例4: answer_call

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import reject [as 别名]
def answer_call():
    r = Response()
    
    if request.form['From'] != config.intercom:
        r.reject(reason='rejected')
    
    if not config.auth:
        r.verbs.extend(grant_access())
    else:
        with r.gather(action=url_for('.check_input'), numDigits=4, timeout=4) as g:
            g.say('Please enter a pin or hold.')
        
        try:
            contact = models.Contact.objects.get(pk=config.forward)
            r.dial(contact.phone_number)
        except models.Contact.DoesNotExist:
            pass
        
        r.say('Goodbye.')
    
    return r
开发者ID:jalaziz,项目名称:doorman,代码行数:23,代码来源:views.py

示例5: verb_view

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import reject [as 别名]
def verb_view(request):
    """A simple test view that returns a ``twilio.Verb`` object."""
    r = Response()
    r.reject()
    return r
开发者ID:robthehall,项目名称:django-twilio,代码行数:7,代码来源:views.py


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