desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Route the specified :class:`Call` to another url. :param url: A valid URL that returns TwiML. :param method: HTTP method Twilio uses when requesting the above URL.'
def route(self, **kwargs):
a = self.parent.route(self.name, **kwargs) self.load(a.__dict__)
'Delete the specified :class:`Call` record from Twilio.'
def delete(self):
return self.parent.delete(self.name)
'Returns a page of :class:`Call` resources as a list. For paging informtion see :class:`ListResource` :param date after: Only list calls started after this datetime :param date before: Only list calls started before this datetime'
@normalize_dates def list(self, from_=None, ended_after=None, ended_before=None, ended=None, started_before=None, started_after=None, started=None, **kwargs):
kwargs['from'] = from_ kwargs['StartTime<'] = started_before kwargs['StartTime>'] = started_after kwargs['StartTime'] = parse_date(started) kwargs['EndTime<'] = ended_before kwargs['EndTime>'] = ended_after kwargs['EndTime'] = parse_date(ended) return self.get_instances(kwargs)
'Returns an iterator of :class:`Call` resources. :param date after: Only list calls started after this datetime :param date before: Only list calls started before this datetime'
@normalize_dates def iter(self, from_=None, ended_after=None, ended_before=None, ended=None, started_before=None, started_after=None, started=None, **kwargs):
kwargs['from'] = from_ kwargs['StartTime<'] = started_before kwargs['StartTime>'] = started_after kwargs['StartTime'] = parse_date(started) kwargs['EndTime<'] = ended_before kwargs['EndTime>'] = ended_after kwargs['EndTime'] = parse_date(ended) return super(Calls, self).iter(**kwargs)
'Make a phone call to a number. :param str to: The phone number to call :param str `from_`: The caller ID (must be a verified Twilio number) :param str url: The URL to read TwiML from when the call connects :param method: The HTTP method Twilio should use to request the url :type method: None (defaults to \'POST\'), \'...
def create(self, to, from_, url, status_method=None, status_events=None, **kwargs):
kwargs['from'] = from_ kwargs['to'] = to kwargs['url'] = url kwargs['status_callback_method'] = status_method kwargs['status_callback_event'] = status_events return self.create_instance(kwargs)
'If this call is queued or ringing, cancel the call. Will not affect in-progress calls. :param sid: A Call Sid for a specific call :returns: Updated :class:`Call` resource'
def cancel(self, sid):
return self.update(sid, status=Call.CANCELED)
'If this call is currently active, hang up the call. If this call is scheduled to be made, remove the call from the queue. :param sid: A Call Sid for a specific call :returns: Updated :class:`Call` resource'
def hangup(self, sid):
return self.update(sid, status=Call.COMPLETED)
'Route the specified :class:`Call` to another url. :param sid: A Call Sid for a specific call :param url: A valid URL that returns TwiML. :param method: The HTTP method Twilio uses when requesting the URL. :returns: Updated :class:`Call` resource'
def route(self, sid, url, method='POST'):
return self.update(sid, url=url, method=method)
'Create feedback for the given call. :param sid: A Call Sid for a specific call :param quality_score: The quality of the call :param issue: A list of issues experienced during the call :returns: A :class:`CallFeedback` object'
def feedback(self, sid, quality_score, issue=None):
uri = ('%s/%s' % (self.uri, sid)) call_feedback_factory = CallFeedbackFactory(uri, self.auth, self.timeout) return call_feedback_factory.create(quality_score=quality_score, issue=issue)
'Delete the given Call record from Twilio.'
def delete(self, sid):
return self.delete_instance(sid)
'Delete this media.'
def delete(self):
return self.parent.delete_instance(self.name)
'Returns a page of :class:`Media` resources as a list. For paging information see :class:`ListResource`. :param date after: Only list media created after this date. :param date before: Only list media created before this date. :param date date_created: Only list media created on this date. :param sid message_sid: Only ...
@normalize_dates def list(self, before=None, after=None, date_created=None, **kw):
kw['DateCreated<'] = before kw['DateCreated>'] = after kw['DateCreated'] = parse_date(date_created) return self.get_instances(kw)
'Delete a :class:`Media`. :param sid: String identifier for a Media resource'
def delete(self, sid):
return self.delete_instance(sid)
'Deletes this caller ID from the account.'
def delete(self):
return self.delete_instance()
'Update the CallerId'
def update(self, **kwargs):
self.update_instance(**kwargs)
'Deletes a specific :class:`CallerId` from the account.'
def delete(self, sid):
self.delete_instance(sid)
':param phone_number: Show caller ids with this phone number. :param friendly_name: Show caller ids with this friendly name.'
def list(self, **kwargs):
return self.get_instances(kwargs)
'Update a specific :class:`CallerId`'
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Begin the validation process for the given number. Returns a dictionary with the following keys **account_sid**: The unique id of the Account to which the Validation Request belongs. **phone_number**: The incoming phone number being validated, formatted with a \'+\' and country code e.g., +16175551212 **friendly_name*...
def validate(self, phone_number, **kwargs):
kwargs['phone_number'] = phone_number params = transform_params(kwargs) (resp, validation) = self.request('POST', self.uri, data=params) return validation
'Search for phone numbers'
def list(self, type='local', country='US', region=None, postal_code=None, lata=None, rate_center=None, **kwargs):
kwargs['in_region'] = kwargs.get('in_region', region) kwargs['in_postal_code'] = kwargs.get('in_postal_code', postal_code) kwargs['in_lata'] = kwargs.get('in_lata', lata) kwargs['in_rate_center'] = kwargs.get('in_rate_center', rate_center) params = transform_params(kwargs) uri = ('%s/%s/%s' % (s...
'Set the proper Account owner of this phone number'
def load(self, entries):
if ('account_sid' in entries): uri = re.sub('AC(.*)', entries['account_sid'], self.parent.base_uri) self.parent = PhoneNumbers(uri, self.parent.auth, self.parent.timeout) self.base_uri = self.parent.uri super(PhoneNumber, self).load(entries)
'Transfer the phone number with sid from the current account to another identified by account_sid'
def transfer(self, account_sid):
a = self.parent.transfer(self.name, account_sid) self.load(a.__dict__)
'Update this phone number instance.'
def update(self, **kwargs):
kwargs_copy = dict(kwargs) change_dict_key(kwargs_copy, from_key='status_callback_url', to_key='status_callback') a = self.parent.update(self.name, **kwargs_copy) self.load(a.__dict__)
'Release this phone number from your account. Twilio will no longer answer calls to this number, and you will stop being billed the monthly phone number fees. The phone number will eventually be recycled and potentially given to another customer, so use with care. If you make a mistake, contact us... we may be able to ...
def delete(self):
return self.parent.delete(self.name)
'Release this phone number from your account. Twilio will no longer answer calls to this number, and you will stop being billed the monthly phone number fees. The phone number will eventually be recycled and potentially given to another customer, so use with care. If you make a mistake, contact us... we may be able to ...
def delete(self, sid):
return self.delete_instance(sid)
':param phone_number: Show phone numbers that match this pattern. :param friendly_name: Show phone numbers with this friendly name :param type: Filter numbers by type. Available types are \'local\', \'mobile\', or \'tollfree\' You can specify partial numbers and use \'*\' as a wildcard.'
def list(self, type=None, **kwargs):
uri = self.uri if type: uri = ('%s/%s' % (self.uri, TYPES[type])) params = transform_params(kwargs) (resp, page) = self.request('GET', uri, params=params) return [self.load_instance(i) for i in page[self.key]]
'Attempt to purchase the specified number. The only required parameters are **either** phone_number or area_code :returns: Returns a :class:`PhoneNumber` instance on success, :data:`False` on failure :raises: A :exc:`TypeError` if neither phone_number or area_code is specified.'
def purchase(self, status_callback_url=None, **kwargs):
kwargs['StatusCallback'] = kwargs.get('status_callback', status_callback_url) if (('phone_number' not in kwargs) and ('area_code' not in kwargs)): raise TypeError('phone_number or area_code is required') number_type = kwargs.pop('type', False) uri = self.uri if number_type: ...
':param type: The type of phone number to search for. :param str country: Only show numbers for this country (iso2) :param str region: When searching the US, show numbers in this state :param str postal_code: Only show numbers in this area code :param str rate_center: US only. :param str near_lat_long: Find close numbe...
def search(self, **kwargs):
return self.available_phone_numbers.list(**kwargs)
'Transfer the phone number with sid from the current account to another identified by account_sid'
def transfer(self, sid, account_sid):
return self.update(sid, account_sid=account_sid)
'Update this phone number instance'
def update(self, sid, **kwargs):
kwargs_copy = dict(kwargs) change_dict_key(kwargs_copy, from_key='status_callback_url', to_key='status_callback') if ('application_sid' in kwargs_copy): for sid_type in ['voice_application_sid', 'sms_application_sid']: if (sid_type not in kwargs_copy): kwargs_copy[sid_typ...
'Removes an associated Phone Number from a Trunk.'
def delete(self):
return self.parent.delete_instance(self.name)
'Retrieves the list of Phone Number resources for a given trunk sid. :param Page: The subset of results that needs to be fetched :param PageSize: The size of the Page that needs to be fetched'
def list(self, **kwargs):
return super(PhoneNumbers, self).list(**kwargs)
'Associates a Phone Number with the given Trunk. :param phone_number_sid: Associates a Phone Number with the given trunk.'
def create(self, phone_number_sid):
data = {'phone_number_sid': phone_number_sid} return self.create_instance(data)
'Disassociates a phone number from the trunk. :param sid: Phone Number Sid'
def delete(self, sid):
return self.delete_instance(sid)
'Deletes a Trunk.'
def delete(self):
return self.parent.delete_instance(self.name)
'Updates a Trunk.'
def update(self, **kwargs):
return self.parent.update_instance(self.name, **kwargs)
'Retrieve the list of Trunk resources. :param Page: The subset of results that needs to be fetched :param PageSize: The size of the Page that needs to be fetched'
def list(self, **kwargs):
return super(Trunks, self).list(**kwargs)
'Creates a Trunk.'
def create(self, **kwargs):
return self.create_instance(kwargs)
'Updates a Trunk. :param sid: A human readable 34 character unique identifier :param body: Request body'
def update(self, sid, body):
return self.update_instance(sid, body)
'Deletes a Trunk. :param sid: A human readable 34 character unique identifier'
def delete(self, sid):
return self.delete_instance(sid)
'Disassociates a Credential List from the trunk.'
def delete(self):
return self.parent.delete_instance(self.name)
'Retrieve the list of Credential List resources for a given trunk sid. :param Page: The subset of results that needs to be fetched :param PageSize: The size of the Page that needs to be fetched'
def list(self, **kwargs):
return super(CredentialLists, self).list(**kwargs)
'Associate a Credential List with a Trunk. :param credential_list_sid: A human readable Credential list sid.'
def create(self, credential_list_sid):
data = {'credential_list_sid': credential_list_sid} return self.create_instance(data)
'Disassociates a Credential List from the Trunk. :param credential_list_sid: A human readable Credential list sid.'
def delete(self, credential_list_sid):
return self.delete_instance(credential_list_sid)
'Disassociate an Ip Access Control List.'
def delete(self):
return self.parent.delete_instance(self.name)
'Retrieve the IP Access Control List resources. :param Page: The subset of results that needs to be fetched :param PageSize: The size of the Page that needs to be fetched'
def list(self, **kwargs):
return super(IpAccessControlLists, self).list(**kwargs)
'Associate an IP Access Control List with a Trunk. :param ip_access_control_list_sid: A human readable IP Access Control list sid.'
def create(self, ip_access_control_list_sid):
data = {'ip_access_control_list_sid': ip_access_control_list_sid} return self.create_instance(data)
'Disassociate an Ip Access Control List from the Trunk. :param ip_access_control_list_sid: A human readable IP Access Control list sid.'
def delete(self, ip_access_control_list_sid):
return self.delete_instance(ip_access_control_list_sid)
'Delete an Origination URL.'
def delete(self):
return self.parent.delete_instance(self.name)
'Update an Origination URL.'
def update(self, **kwargs):
return self.parent.update_instance(self.name, kwargs)
'Create a Origination URL. :param friendly_name: A human readable descriptive text, up to 64 characters long. :param sip_url: The SIP address you want Twilio to route your Origination calls to. This must be a sip: schema. :param priority: Priority ranks the importance of the URI. Value ranges from 0 - 65535. :param wei...
def create(self, friendly_name, sip_url, priority, weight, enabled):
data = {'friendly_name': friendly_name, 'sip_url': sip_url, 'priority': priority, 'weight': weight, 'enabled': enabled} return self.create_instance(data)
'Retrieve the list of Origination URL resources for a given trunk sid. :param Page: The subset of results that needs to be fetched :param PageSize: The size of the Page that needs to be fetched'
def list(self, **kwargs):
return super(OriginationUrls, self).list(**kwargs)
'Update an Origination Url. :param origination_url_sid: A human readable Origination Url sid. :param data: Attributes that needs to be updated.'
def update(self, origination_url_sid, data):
return self.update_instance(origination_url_sid, data)
'Delete an Origination Url. :param origination_url_sid: A human readable Origination Url sid.'
def delete(self, origination_url_sid):
return self.delete_instance(origination_url_sid)
'Returns a list of :class:`Member` resources in the given queue :param queue_sid: :class:`Queue` this participant is part of'
def list(self, **kwargs):
return self.get_instances(kwargs)
'Dequeues a member from the queue and have the member\'s call begin executing the TwiML document at the url. :param call_sid: Call sid specifying the member, if not given, the member at the front of the queue will be used :param url: url of the TwiML document to be executed.'
def dequeue(self, url, call_sid='Front', **kwargs):
kwargs['url'] = url return self.update_instance(call_sid, kwargs)
'Update this queue :param friendly_name: A new friendly name for this queue :param max_size: A new max size. Changing a max size to less than the current size results in the queue rejecting incoming requests until it shrinks below the new max size'
def update(self, **kwargs):
return self.parent.update_instance(self.name, kwargs)
'Delete this queue. Can only be run on empty queues.'
def delete(self):
return self.parent.delete_instance(self.name)
'Returns a page of :class:`Queue` resources as a list sorted by DateUpdated. For paging informtion see :class:`ListResource`'
def list(self, **kwargs):
return self.get_instances(kwargs)
'Create an :class:`Queue` with any of these optional parameters. :param name: A human readable description of the application, with maximum length 64 characters. :param max_size: The limit on calls allowed into the queue (optional)'
def create(self, name, **kwargs):
kwargs['friendly_name'] = name return self.create_instance(kwargs)
'Update a :class:`Queue` :param sid: String identifier for a Queue resource :param friendly_name: A new friendly name for this queue :param max_size: A new max size. Changing a max size to less than the current size results in the queue rejecting incoming requests until it shrinks below the new max size'
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Delete a :class:`Queue`. Can only be run on empty queues. :param sid: String identifier for a Queue resource'
def delete(self, sid):
return self.delete_instance(sid)
'Update the status of an account. :param friendly_name: Update the description of this account. :param status: Alter the status of this account Use :const:`CLOSED` to irreversibly close this account, :const:`SUSPENDED` to temporarily suspend it, or :const:`ACTIVE` to reactivate it.'
def update(self, **kwargs):
self.update_instance(**kwargs)
'Permenently deactivate this account'
def close(self):
return self.update_instance(status=Account.CLOSED)
'Temporarily suspend this account'
def suspend(self):
return self.update_instance(status=Account.SUSPENDED)
'Reactivate this account'
def activate(self):
return self.update_instance(status=Account.ACTIVE)
'Returns a page of :class:`Account` resources as a list. For paging informtion see :class:`ListResource` :param date friendly_name: Only list accounts with this friendly name :param date status: Only list accounts with this status'
def list(self, **kwargs):
return self.get_instances(kwargs)
':param sid: Account identifier :param friendly_name: Update the description of this account. :param status: Alter the status of this account Use :data:`CLOSED` to irreversibly close this account, :data:`SUSPENDED` to temporarily suspend it, or :data:`ACTIVE` to reactivate it.'
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Permenently deactivate an account, Alias to update'
def close(self, sid):
return self.update(sid, status=Account.CLOSED)
'Temporarily suspend an account, Alias to update'
def suspend(self, sid):
return self.update(sid, status=Account.SUSPENDED)
'Reactivate an account, Alias to update'
def activate(self, sid):
return self.update(sid, status=Account.ACTIVE)
'Returns a newly created sub account resource. :param friendly_name: Update the description of this account.'
def create(self, **kwargs):
return self.create_instance(kwargs)
'Update this key'
def update(self, **kwargs):
return self.parent.update(self.name, **kwargs)
'Delete this key'
def delete(self):
return self.parent.delete(self.name)
'Create a :class:`Key` with any of these optional parameters. :param friendly_name: A human readable description of the signing key.'
def create(self, **kwargs):
return self.create_instance(kwargs)
'Update a :class:`Key` with the given parameters. All the parameters are describe above in :meth:`create`'
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Delete a :class:`Key`'
def delete(self, sid):
return self.delete_instance(sid)
'Returns a page of :class:`Key` resources as a list'
def list(self, **kwargs):
return self.get_instances(kwargs)
'Returns the currently-set proxy information as an httplib2.ProxyInfo object.'
@classmethod def proxy_info(cls):
return cls._proxy_info
'Set proxy configuration for future REST API calls. :param str proxy_host: Hostname of the proxy to use. :param int proxy_port: Port to connect to. :param proxy_type: The proxy protocol to use. One of PROXY_TYPE_HTTP, PROXY_TYPE_SOCKS4, PROXY_TYPE_SOCKS5. Defaults to connection.PROXY_TYPE_HTTP. :param bool proxy_rdns: ...
@classmethod def set_proxy_info(cls, proxy_host, proxy_port, proxy_type=PROXY_TYPE_HTTP, proxy_rdns=None, proxy_user=None, proxy_pass=None):
cls._proxy_info = httplib2.ProxyInfo(proxy_type, proxy_host, proxy_port, proxy_rdns=proxy_rdns, proxy_user=proxy_user, proxy_pass=proxy_pass)
'Returns a page of :class:`ShortCode` resources as a list. For paging information see :class:`ListResource`. :param short_code: Only show the ShortCode resources that match this pattern. You can specify partial numbers and use \'*\' as a wildcard for any digit. :param friendly_name: Only show the ShortCode resources wi...
def list(self, **kwargs):
return self.get_instances(kwargs)
'Update a specific :class:`ShortCode`, by specifying the sid. :param friendly_name: Description of the short code, with maximum length 64 characters. :param api_version: SMSs to this short code will start a new TwiML session with this API version. :param url: The URL that Twilio should request when somebody sends an SM...
def update(self, sid, url=None, method=None, fallback_url=None, fallback_method=None, **kwargs):
kwargs['sms_url'] = kwargs.get('sms_url', url) kwargs['sms_method'] = kwargs.get('sms_method', method) kwargs['sms_fallback_url'] = kwargs.get('sms_fallback_url', fallback_url) kwargs['sms_fallback_method'] = kwargs.get('sms_fallback_method', fallback_method) return self.update_instance(sid, kwargs)...
'Create and send a SMS Message. :param str to: The destination phone number. :param str `from_`: The phone number sending this message (must be a verified Twilio number) :param str body: The message you want to send, limited to 160 characters. :param status_callback: A URL that Twilio will POST to when your message is ...
def create(self, from_=None, **kwargs):
kwargs['from'] = from_ return self.create_instance(kwargs)
'Returns a page of :class:`~twilio.rest.resources.SmsMessage` resources as a list. For paging information see :class:`ListResource`. :param to: Only show SMS messages to this phone number. :param from_: Only show SMS messages from this phone number. :param date after: Only list SMS messages sent after this date. :param...
@normalize_dates def list(self, from_=None, before=None, after=None, date_sent=None, **kw):
kw['From'] = from_ kw['DateSent<'] = before kw['DateSent>'] = after kw['DateSent'] = parse_date(date_sent) return self.get_instances(kw)
'Delete this Message record from Twilio.'
def delete(self):
return self.parent.delete(self.sid)
'Redact this Message\'s `body` field from Twilio while preserving the record itself and related metadata.'
def redact(self):
return self.parent.redact(self.sid)
'Create and send a Message. :param str to: The destination phone number. :param str `from_`: The phone number sending this message (must be a verified Twilio number) :param str body: The message you want to send, limited to 1600 characters. :param list media_url: A list of URLs of images to include in the message. :par...
def create(self, from_=None, **kwargs):
kwargs['from'] = from_ return self.create_instance(kwargs)
'Returns a page of :class:`Message` resources as a list. For paging information see :class:`ListResource`. :param to: Only show messages to this phone number. :param from_: Only show messages from this phone number. :param date after: Only list messages sent after this date. :param date before: Only list message sent b...
@normalize_dates def list(self, from_=None, before=None, after=None, date_sent=None, **kw):
kw['From'] = from_ kw['DateSent<'] = before kw['DateSent>'] = after kw['DateSent'] = parse_date(date_sent) return self.get_instances(kw)
'Returns an iterator of :class:`Message` resources. :param date after: Only list calls started after this datetime :param date before: Only list calls started before this datetime'
@normalize_dates def iter(self, from_=None, to=None, before=None, after=None, date_sent=None, **kwargs):
kwargs['From'] = from_ kwargs['To'] = to kwargs['DateSent<'] = before kwargs['DateSent>'] = after kwargs['DateSent'] = parse_date(date_sent) return super(Messages, self).iter(**kwargs)
'Updates the message for the given sid :param sid: The sid of the message to update.'
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Delete the specified Message record from Twilio.'
def delete(self, sid):
return self.delete_instance(sid)
'Redact the specified Message record\'s Body field.'
def redact(self, sid):
return self.update_instance(sid, {'Body': ''})
'Retrieve pricing information for Twilio Numbers in the specified country. :param iso_country: The two-letter ISO code for the country'
def get(self, iso_country):
return self.get_instance(iso_country)
'Retrieve the list of countries in which Twilio Numbers are available.'
def list(self):
(resp, page) = self.request('GET', self.uri) return [self.load_instance(i) for i in page[self.key]]
'Retrieve pricing information for Twilio Voice in the specified country. :param iso_country: The two-letter ISO code for the country'
def get(self, iso_country):
return self.get_instance(iso_country)
'Retrieve the list of countries in which Twilio Voice is available.'
def list(self):
(resp, page) = self.request('GET', self.uri) return [self.load_instance(i) for i in page[self.key]]
'Retrieve pricing information for a specific phone number. :param phone_number: the E.164-formatted number to retrieve info for :return: a :class:`VoiceNumber` instance'
def get(self, phone_number):
return self.get_instance(phone_number)
'Retrieve pricing information for Twilio Messages in the specified country. :param iso_country: The two-letter ISO code for the country'
def get(self, iso_country):
return self.get_instance(iso_country)
'Retrieve the list of countries in which Twilio Messages are available.'
def list(self, **kwargs):
return super(MessagingCountries, self).list(**kwargs)
'Update this usage trigger'
def update(self, **kwargs):
return self.parent.update(self.name, **kwargs)