本文整理汇总了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
示例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
示例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
示例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
示例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