示例#1
0
# 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.outgoing_caller_ids("PNe536d32a3c49700934481addd5ce1659") \
      .delete()
示例#2
0
#write requests & responses from Twilio to log file, useful for debugging:
logging.basicConfig(
    level=logging.DEBUG,
    format='%(asctime)s %(levelname)s %(message)s',
    filename=
    '/usr/local/twilio/python3/sdkv6x/outgoing_caller_ids/logs/twilio_outgoing_caller_ids.log',
    filemode='a')

# Your Account Sid and Auth Token from twilio.com/console & stored in Mac OS ~/.bash_profile in this example
account_sid = os.environ.get('$TWILIO_ACCOUNT_SID')
auth_token = os.environ.get('$TWILIO_AUTH_TOKEN')
client = Client(account_sid, auth_token)

# A list of outgoing_caller_id parameters & their permissable values

client.outgoing_caller_ids('PNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx').delete()

# print list of all outgoing_caller_id properties to console, useful for learning info available you can work with?
#print(outgoing_caller_id.account_sid)
#print(outgoing_caller_id.date_created)
#print(outgoing_caller_id.date_updated)
#print(outgoing_caller_id.friendly_name)
#print(outgoing_caller_id.phone_number)
#print(outgoing_caller_id.sid)
#print(outgoing_caller_id.uri)

# create variable for this outgoing_caller_id
#cdr = (outgoing_caller_id.sid)
# open *.log file with cdr var as filename...
#f = open("/usr/local/twilio/python3/sdkv6x/outgoing_caller_ids/logs/" + str( cdr ) + ".log", "a")
# write list of all outgoing_caller_id properties to above file...
示例#3
0
# Download the Python helper library from twilio.com/docs/python/install
import os
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)

caller_id = client.outgoing_caller_ids("PNe905d7e6b410746a0fb08c57e5a186f3") \
                  .fetch()

print(caller_id.phone_number)
# 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)
# Download the Python helper library from twilio.com/docs/python/install
import os
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_AUTH_TOKEN']
client = Client(account_sid, auth_token)

caller_id = client.outgoing_caller_ids("PNe536d32a3c49700934481addd5ce1659") \
                  .update(friendly_name="My Second Line")

print(caller_id.phone_number)
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client


# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

client.outgoing_caller_ids('PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = '"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

client.outgoing_caller_ids("PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete()
# 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("PNe536d32a3c49700934481addd5ce1659") \
                  .update(friendly_name="My Second Line")

print(caller_id.phone_number)