本文整理汇总了Python中twilio.rest.Client类的典型用法代码示例。如果您正苦于以下问题:Python Client类的具体用法?Python Client怎么用?Python Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: incoming_sms
def incoming_sms(request):
""" Changes worker activity and returns a confirmation """
client = Client(ACCOUNT_SID, AUTH_TOKEN)
activity = 'Idle' if request.POST['Body'].lower().strip() == 'on' else 'Offline'
activity_sid = WORKSPACE_INFO.activities[activity].sid
worker_sid = WORKSPACE_INFO.workers[request.POST['From']]
workspace_sid = WORKSPACE_INFO.workspace_sid
client.workspaces(workspace_sid)\
.workers(worker_sid)\
.update(activity_sid=activity_sid)
resp = MessagingResponse()
message = 'Your status has changed to ' + activity
resp.message(message)
return HttpResponse(resp)
示例2: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
sms = client.messages("SM800f449d0399ed014aae2bcc0cc2f2ec") \
.fetch()
print(sms.body.encode('utf-8'))
示例3: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
client.messages("MM800f449d0399ed014aae2bcc0cc2f2ec") \
.update(body="")
示例4: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
short_code = client.short_codes("SC6b20cb705c1e8f00210049b20b70fce2") \
.fetch()
print(short_code.short_code)
示例5: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
numbers = client.available_phone_numbers("US").toll_free.list()
number = client.incoming_phone_numbers.create(phone_number=numbers[0].phone_number)
print(number.sid)
示例6: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
number = client.incoming_phone_numbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e").update(
voice_url="http://demo.twilio.com/docs/voice.xml", sms_url="http://demo.twilio.com/docs/sms.xml"
)
print(number.voice_url)
示例7: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
numbers = client.available_phone_numbers("US") \
.local \
.list(near_lat_long="37.840699,-122.461853",
distance="50",
contains="555",
in_region="CA")
number = client.incoming_phone_numbers \
.create(phone_number=numbers[0].phone_number)
print(number.sid)
示例8: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
call = client.calls("CAe1644a7eed5088b159577c5802d8be38").update(status="completed")
print(call.direction)
示例9: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
numbers = client.available_phone_numbers("GB") \
.mobile \
.list()
number = client.incoming_phone_numbers \
.create(phone_number=numbers[0].phone_number)
print(number.sid)
示例10: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
account = client.accounts("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()
print(account.date_created)
示例11: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
# A list of participant objects with the properties described above
participants = client.conferences('CFbbe4632a3c49700934481addd5ce1659') \
.participants \
.list()
for participant in participants:
print(participant.muted)
示例12: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
caller_id = client.outgoing_caller_ids("PNe905d7e6b410746a0fb08c57e5a186f3") \
.fetch()
print(caller_id.phone_number)
示例13: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
client.messages("MM800f449d0399ed014aae2bcc0cc2f2ec") \
.media("ME557ce644e5ab84fa21cc21112e22c485") \
.delete()
示例14: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
queue = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
.fetch()
print(queue.average_wait_time)
示例15: Client
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
client.recordings("RE557ce644e5ab84fa21cc21112e22c485") \
.delete()