當前位置: 首頁>>代碼示例>>Python>>正文


Python rest.Client類代碼示例

本文整理匯總了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)
開發者ID:TwilioDevEd,項目名稱:task-router-django,代碼行數:16,代碼來源:views.py

示例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'))
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:14,代碼來源:instance-get-example-1.6.x.py

示例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="")
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:10,代碼來源:instance-post-example-1.6.x.py

示例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)
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:12,代碼來源:instance-get-example-1.6.x.py

示例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)
開發者ID:TwilioDevEd,項目名稱:api-snippets,代碼行數:13,代碼來源:toll-free-get-example-1.6.x.py

示例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)
開發者ID:TwilioDevEd,項目名稱:api-snippets,代碼行數:13,代碼來源:instance-post-example-1.6.x.py

示例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)
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:19,代碼來源:local-get-advanced-example-1.6.x.py

示例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)
開發者ID:TwilioDevEd,項目名稱:api-snippets,代碼行數:11,代碼來源:list-get-example-2.6.x.py

示例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)
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:16,代碼來源:mobile-get-example-1.6.x.py

示例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)
開發者ID:TwilioDevEd,項目名稱:api-snippets,代碼行數:10,代碼來源:instance-get-example-1.6.x.py

示例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)
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:15,代碼來源:list-get-example-1.6.x.py

示例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)
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:12,代碼來源:instance-get-example-1.6.x.py

示例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()
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:11,代碼來源:instance-delete-example-1.6.x.py

示例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)
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:12,代碼來源:instance-get-example-1.6.x.py

示例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()
開發者ID:GilbertoBotaro,項目名稱:api-snippets,代碼行數:10,代碼來源:instance-delete-examples.6.x.py


注:本文中的twilio.rest.Client類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。