本文整理汇总了Python中twilio.util.TwilioCapability类的典型用法代码示例。如果您正苦于以下问题:Python TwilioCapability类的具体用法?Python TwilioCapability怎么用?Python TwilioCapability使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TwilioCapability类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: incoming_twilio_phone_client_loader
def incoming_twilio_phone_client_loader(request):
from twilio.util import TwilioCapability
account_sid = "AC260e405c96ce1eddffbddeee43a13004"
auth_token = "fd219130e257e25e78613adc6c003d1a"
capability = TwilioCapability(account_sid, auth_token)
capability.allow_client_incoming(str(request.user.username))
return render(request, 'comm/incoming_phone.html', locals())
开发者ID:SlashRoot,项目名称:WHAT,代码行数:7,代码来源:services.py
示例2: question_translator
def question_translator(request, question):
if question.translator and not question.translator == request.user:
return HttpResponseRedirect(reverse('dashboard'))
if request.method == "POST":
if 'set_translator' in request.POST:
question.translator = request.user
if 'translation' in request.POST:
question.translation = request.POST['translation']
if 'is_translated' in request.POST:
question.is_translated = request.POST['is_translated']
if 'is_calledback' in request.POST:
question.is_calledback = request.POST['is_calledback']
question.save()
if ('is_calledback' in request.POST and question.is_calledback) or ('is_translated' in request.POST and question.is_translated):
return HttpResponseRedirect(reverse('dashboard'))
if question.is_translated:
from twilio.util import TwilioCapability
capability = TwilioCapability(settings.TWILIO_ACCT_SID, settings.TWILIO_AUTH_TOKEN)
capability.allow_client_outgoing(settings.TWILIO_OUTGOING_APP_ID)
capability_token = capability.generate()
else:
capability_token = ''
return render_to_response('question_translator.html', {
'question': question,
'capability_token': capability_token,
}, context_instance=RequestContext(request))
开发者ID:robboyle,项目名称:asesor,代码行数:32,代码来源:views.py
示例3: start
def start(client_name):
twilio_capability = TwilioCapability(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
twilio_capability.allow_client_incoming(client_name)
capability_token = twilio_capability.generate()
return render_template('client.html', capability_token=capability_token, client_name=client_name)
开发者ID:kelvl,项目名称:twilio-call-transfer-example,代码行数:7,代码来源:call-transfer.py
示例4: voiceclient
def voiceclient():
capability = TwilioCapability(account_sid, auth_token)
capability.allow_client_outgoing(application_sid)
token = capability.generate()
return render_template('voiceclient.html', token=token)
开发者ID:gholadr,项目名称:twilio-prototype,代码行数:7,代码来源:run.py
示例5: test_events_with_filters
def test_events_with_filters(self):
token = TwilioCapability("AC123", "XXXXX")
token.allow_event_stream(foobar="hey")
payload = token.payload()
event_uri = "scope:stream:subscribe?params=foobar%3Dhey&path=%2F2010-04-01%2FEvents"
assert_equal(payload["scope"], event_uri)
开发者ID:42cc,项目名称:twilio-python,代码行数:7,代码来源:test_jwt.py
示例6: index
def index():
reason = reasonSonyaIsAwesome()
capability = TwilioCapability(app.config['ACCOUNT_SID'],
app.config['AUTH_TOKEN'])
capability.allow_client_outgoing(app.config['SONYA_APP_SID'])
token = capability.generate()
return render_template('index.html', token=token, reason=reason)
开发者ID:ThomasWunderlich,项目名称:Reasons-Sonya-Is-Awesome,代码行数:7,代码来源:app.py
示例7: clienttoken
def clienttoken(self, var=None, **params):
clientid = urllib.unquote(cherrypy.request.params['clientid'])
room = clientid.split(".")[0]
user = clientid.split(".")[1]
capability = TwilioCapability(account, token)
capability.allow_client_outgoing(application_sid)
return capability.generate()
开发者ID:Rumyra,项目名称:pusher2talk,代码行数:7,代码来源:pusher2talk.py
示例8: audio
def audio(campaign_id):
campaign = Campaign.query.filter_by(id=campaign_id).first_or_404()
form = CampaignAudioForm()
twilio_client = current_app.config.get("TWILIO_CLIENT")
twilio_capability = TwilioCapability(*twilio_client.auth)
twilio_capability.allow_client_outgoing(current_app.config.get("TWILIO_PLAYBACK_APP"))
for field in form:
campaign_audio, is_default_message = campaign.audio_or_default(field.name)
if not is_default_message:
field.data = campaign_audio
if form.validate_on_submit():
form.populate_obj(campaign)
db.session.add(campaign)
db.session.commit()
flash("Campaign audio updated.", "success")
return redirect(url_for("campaign.launch", campaign_id=campaign.id))
return render_template(
"campaign/audio.html",
campaign=campaign,
form=form,
twilio_capability=twilio_capability,
descriptions=current_app.config.CAMPAIGN_FIELD_DESCRIPTIONS,
example_text=current_app.config.CAMPAIGN_MESSAGE_DEFAULTS,
)
开发者ID:spacedogXYZ,项目名称:call-power,代码行数:30,代码来源:views.py
示例9: get_twilio_token
def get_twilio_token():
user = ensureLogin(None)
if(user == None):
return {'result':'Failure', 'message':'Unauthenticated'}
# from trial account of [email protected]
# account_sid = "AC3c6446cabf093a6d43eb5743bb067734"
# auth_token = "81ce4d34613c2d8cc6c4492abc01fa14"
# application_sid = "AP1f6c103b3e8f4db78b85d6b6c78a10c4"
# application_sid = "AP2dc65dfde4f16248498ade72fa759cc9"
# from real account of [email protected]
# account_sid = "ACd7492f73100e1169b076b734253b85d9"
# auth_token = "e52b5cca6cc4295337838ac9fcb13421"
account_sid = hmpconstants.TwilioSetup.account_sid
auth_token = hmpconstants.TwilioSetup.auth_token
# This is a special Quickstart application sid - or configure your own
# at twilio.com/user/account/apps
# application_sid pointing to manoj's local dev
# application_sid = "AP6cf341f0c8d65f51cb7a908ae944cbf1"
# application_sid pointing to remedysquare prod
# application_sid = "APcc1d73bf14b7f0b998a0f86a96a8e552"
application_sid = hmpconstants.TwilioSetup.application_sid
capability = TwilioCapability(account_sid, auth_token)
capability.allow_client_outgoing(application_sid)
token = capability.generate()
return {'result':'Success', 'message':token,'token':token}
开发者ID:prajwalds,项目名称:hmp-web,代码行数:35,代码来源:main.py
示例10: home
def home(request):
data = {}
capability = TwilioCapability(twillio_account, twillio_token)
capability.allow_client_outgoing(twillio_sid)
data["token"] = capability.generate()
return render_to_response("home.html", data)
开发者ID:4geeks,项目名称:retosuas,代码行数:7,代码来源:views.py
示例11: index
def index():
braintree_token = client_token()
capability = TwilioCapability(config.twilio['account_sid'], config.twilio['auth_token'])
capability.allow_client_outgoing(config.twilio['app_sid'])
twilio_token = capability.generate()
return render_template('index.jade', title="Phone WTF", twilio_token=twilio_token)
开发者ID:nickgirardo,项目名称:PhoneWtf,代码行数:7,代码来源:phonewtf.py
示例12: generate_token
def generate_token():
capability = TwilioCapability(account_sid, auth_token)
capability.allow_client_outgoing(application_sid)
test = capability.generate()
print(test)
#return capaddbility.generate()
return test
开发者ID:dinalamdany,项目名称:instagramophone,代码行数:7,代码来源:app.py
示例13: test_outbound_permissions_params
def test_outbound_permissions_params(self):
token = TwilioCapability("AC123", "XXXXX")
token.allow_client_outgoing("AP123", foobar=3)
payload = token.payload()
eurl = "scope:client:outgoing?appParams=foobar%3D3&appSid=AP123"
assert_equal(payload["scope"], eurl)
开发者ID:42cc,项目名称:twilio-python,代码行数:7,代码来源:test_jwt.py
示例14: test_events
def test_events(self):
token = TwilioCapability("AC123", "XXXXX")
token.allow_event_stream()
payload = token.payload()
event_uri = "scope:stream:subscribe?path=%2F2010-04-01%2FEvents"
assert_equal(payload["scope"], event_uri)
开发者ID:42cc,项目名称:twilio-python,代码行数:7,代码来源:test_jwt.py
示例15: test_inbound_permissions
def test_inbound_permissions(self):
token = TwilioCapability("AC123", "XXXXX")
token.allow_client_incoming("andy")
payload = token.payload()
eurl = "scope:client:incoming?clientName=andy"
assert_equal(len(payload), 1)
assert_equal(payload['scope'], eurl)
开发者ID:42cc,项目名称:twilio-python,代码行数:8,代码来源:test_jwt.py
示例16: index
def index(name="Somebody Put Something In My Ring"):
# Generate Twilio client token
capability = TwilioCapability(app.config['ACCOUNT_SID'],
app.config['AUTH_TOKEN'])
capability.allow_client_outgoing(app.config['RAMONES_APP_SID'])
token = capability.generate()
return render_template('index.html', name=name, token=token)
开发者ID:RobSpectre,项目名称:Somebody-Put-Something-In-My-Ring,代码行数:8,代码来源:app.py
示例17: main_page
def main_page():
"""Respond to incoming requests."""
capability = TwilioCapability(account_sid, auth_token)
capability.allow_client_outgoing(application_sid)
token = capability.generate()
return render_template('index.html', token=token)
开发者ID:DanPatey,项目名称:Prank-Roulette,代码行数:8,代码来源:app.py
示例18: generate_token
def generate_token(account_sid, auth_token, application_sid):
"""
Create a capability token given Twilio account credentials
and an application sid.
"""
capability = TwilioCapability(account_sid, auth_token)
# Allow access to the Call-in ApplicationSid we created
capability.allow_client_outgoing(application_sid)
return capability.generate()
开发者ID:Agilemeister,项目名称:workshop,代码行数:9,代码来源:util.py
示例19: test_outbound_permissions
def test_outbound_permissions(self):
token = TwilioCapability("AC123", "XXXXX")
token.allow_client_outgoing("AP123")
payload = token.payload()
eurl = "scope:client:outgoing?appSid=AP123"
assert_equal(len(payload), 1)
self.assertIn(eurl, payload['scope'])
开发者ID:42cc,项目名称:twilio-python,代码行数:9,代码来源:test_jwt.py
示例20: test
def test(self, var=None, **params):
room = str(urllib.unquote(cherrypy.request.params['room']))
user = str(urllib.unquote(cherrypy.request.params['user']))
capability = TwilioCapability(account, token)
capability.allow_client_outgoing(application_sid)
template_values = {"token": capability.generate(), "room" : room, "user": user}
t = loader.get_template('test.html')
c = Context(template_values)
return t.render(c)
开发者ID:Rumyra,项目名称:pusher2talk,代码行数:9,代码来源:pusher2talk.py
注:本文中的twilio.util.TwilioCapability类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论