desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Stops the serve_forever loop. Blocks until the loop has finished. This must be called while serve_forever() is running in another thread, or it will deadlock.'
def shutdown(self):
self.__serving = False self.__is_shut_down.wait()
'Handle one request, possibly blocking. Respects self.timeout.'
def handle_request(self):
timeout = self.socket.gettimeout() if (timeout is None): timeout = self.timeout elif (self.timeout is not None): timeout = min(timeout, self.timeout) fd_sets = select.select([self], [], [], timeout) if (not fd_sets[0]): self.handle_timeout() return self._handle_re...
'Handle one request, without blocking. I assume that select.select has returned that the socket is readable before this function was called, so there should be no risk of blocking in get_request().'
def _handle_request_noblock(self):
try: (request, client_address) = self.get_request() except socket.error: return if self.verify_request(request, client_address): try: self.process_request(request, client_address) except: self.handle_error(request, client_address) self.clos...
'Create a policy dictionary for the given resource and method. :param str url: the resource URL to grant or deny access to :param str method: the HTTP method to allow or deny :param allowed bool: whether this request is allowed :param dict query_filter: specific GET parameter names to require or allow :param dict post_...
def make_policy(self, url, method, allowed=True, query_filter=None, post_filter=None):
return {'url': url, 'method': method, 'allow': allowed, 'query_filter': (query_filter or {}), 'post_filter': (post_filter or {})}
'Compute the signature for a given request :param uri: full URI that Twilio requested on your server :param params: post vars that Twilio sent with the request :param utf: whether return should be bytestring or unicode (python3) :returns: The computed signature'
def compute_signature(self, uri, params, utf=PY3):
s = uri if (len(params) > 0): for (k, v) in sorted(params.items()): s += (k + v) mac = hmac.new(self.token, s.encode('utf-8'), sha1) computed = base64.b64encode(mac.digest()) if utf: computed = computed.decode('utf-8') return computed.strip()
'Validate a request from Twilio :param uri: full URI that Twilio requested on your server :param params: post vars that Twilio sent with the request :param signature: expexcted signature in HTTP X-Twilio-Signature header :returns: True if the request passes validation, False if not'
def validate(self, uri, params, signature):
return secure_compare(self.compute_signature(uri, params), signature)
'Return the payload for this token.'
def payload(self):
if (('outgoing' in self.capabilities) and (self.client_name is not None)): scope = self.capabilities['outgoing'] scope.params['clientName'] = self.client_name capabilities = self.capabilities.values() scope_uris = [str(scope_uri) for scope_uri in capabilities] return {'scope': ' '.joi...
'Generate a valid JWT token with an expiration date. :param int expires: The token lifetime, in seconds. Defaults to 1 hour (3600)'
def generate(self, expires=3600):
payload = self.payload() payload['iss'] = self.account_sid payload['exp'] = int((time.time() + expires)) return jwt.encode(payload, self.auth_token)
'Allow the user of this token to make outgoing connections. Keyword arguments are passed to the application. :param str application_sid: Application to contact'
def allow_client_outgoing(self, application_sid, **kwargs):
scope_params = {'appSid': application_sid} if kwargs: scope_params['appParams'] = urlencode(kwargs, doseq=True) self.capabilities['outgoing'] = ScopeURI('client', 'outgoing', scope_params)
'If the user of this token should be allowed to accept incoming connections then configure the TwilioCapability through this method and specify the client name. :param str client_name: Client name to accept calls from'
def allow_client_incoming(self, client_name):
self.client_name = client_name self.capabilities['incoming'] = ScopeURI('client', 'incoming', {'clientName': client_name})
'Allow the user of this token to access their event stream.'
def allow_event_stream(self, **kwargs):
scope_params = {'path': '/2010-04-01/Events'} if kwargs: scope_params['params'] = urlencode(kwargs, doseq=True) self.capabilities['events'] = ScopeURI('stream', 'subscribe', scope_params)
'Returns a :class:`MessagingCountries` resource :return: MessagingCountries'
def messaging_countries(self):
messaging_countries_uri = '{0}/Messaging'.format(self.uri_base) return MessagingCountries(messaging_countries_uri, self.auth, self.timeout)
'Create a Twilio API client.'
def __init__(self, account=None, token=None, base='https://api.twilio.com', version='2010-04-01', timeout=UNSET_TIMEOUT, request_account=None):
if ((not account) or (not token)): (account, token) = find_credentials() if ((not account) or (not token)): raise TwilioException('\nTwilio could not find your account credentials. Pass them into the\nTwilioRestClient constructor like this:\n\n ...
'sends a request and gets a response from the Twilio REST API .. deprecated:: 3.0 :param path: the URL (relative to the endpoint URL, after the /v1 :param url: the HTTP method to use, defaults to POST :param vars: for POST or PUT, a dict of data to send :returns: Twilio response in XML or raises an exception on error :...
def request(self, path, method=None, vars=None):
logging.warning(':meth:`TwilioRestClient.request` is deprecated and will be removed in a future version') vars = (vars or {}) params = None data = None if ((not path) or (len(path) < 1)): raise ValueError('Invalid path parameter') if (method and (metho...
'Try to pretty-print the exception, if this is going on screen.'
def __str__(self):
def red(words): return (u('\x1b[31m\x1b[49m%s\x1b[0m') % words) def white(words): return (u('\x1b[37m\x1b[49m%s\x1b[0m') % words) def blue(words): return (u('\x1b[34m\x1b[49m%s\x1b[0m') % words) def teal(words): return (u('\x1b[36m\x1b[49m%s\x1b[0m') % words) def get_...
'Create a Twilio REST API client.'
def __init__(self, account=None, token=None, base='https://api.twilio.com', version='2010-04-01', timeout=UNSET_TIMEOUT, request_account=None):
super(TwilioRestClient, self).__init__(account, token, base, version, timeout, request_account) version_uri = ('%s/%s' % (base, version)) self.accounts = Accounts(version_uri, self.auth, timeout) self.applications = Applications(self.account_uri, self.auth, timeout) self.authorized_connect_apps = Au...
'Return a :class:`~twilio.rest.resources.Participants` instance for the :class:`~twilio.rest.resources.Conference` with given conference_sid'
def participants(self, conference_sid):
base_uri = ('%s/Conferences/%s' % (self.account_uri, conference_sid)) return Participants(base_uri, self.auth, self.timeout)
'Return a :class:`Members <twilio.rest.resources.Members>` instance for the :class:`Queue <twilio.rest.resources.Queue>` with the given queue_sid'
def members(self, queue_sid):
base_uri = ('%s/Queues/%s' % (self.account_uri, queue_sid)) return Members(base_uri, self.auth, self.timeout)
'Return a :class:`CallFeedback <twilio.rest.resources.CallFeedback>` instance for the :class:`Call <twilio.rest.resources.calls.Call>` with the given call_sid'
def feedback(self, call_sid):
base_uri = ('%s/Calls/%s/Feedback' % (self.account_uri, call_sid)) call_feedback_list = CallFeedbackFactory(base_uri, self.auth, self.timeout) return CallFeedback(call_feedback_list)
'Return a :class:`DependentPhoneNumbers <twilio.rest.resources.DependentPhoneNumbers>` instance for the :class:`Address <twilio.rest.resources.Address>` with the given address_sid'
def dependent_phone_numbers(self, address_sid):
base_uri = ('%s/Addresses/%s' % (self.account_uri, address_sid)) return DependentPhoneNumbers(base_uri, self.auth, self.timeout)
'Create a Twilio REST API client.'
def __init__(self, account=None, token=None, base='https://trunking.twilio.com', version='v1', timeout=UNSET_TIMEOUT, request_account=None):
super(TwilioTrunkingClient, self).__init__(account, token, base, version, timeout, request_account) self.trunk_base_uri = '{0}/{1}'.format(base, version)
'Return a :class:`CredentialList` instance'
def credential_lists(self, trunk_sid):
credential_lists_uri = '{0}/Trunks/{1}'.format(self.trunk_base_uri, trunk_sid) return CredentialLists(credential_lists_uri, self.auth, self.timeout)
'Return a :class:`IpAccessControlList` instance'
def ip_access_control_lists(self, trunk_sid):
ip_access_control_lists_uri = '{0}/Trunks/{1}'.format(self.trunk_base_uri, trunk_sid) return IpAccessControlLists(ip_access_control_lists_uri, self.auth, self.timeout)
'Return a :class:`OriginationUrls` instance'
def origination_urls(self, trunk_sid):
origination_urls_uri = '{0}/Trunks/{1}'.format(self.trunk_base_uri, trunk_sid) return OriginationUrls(origination_urls_uri, self.auth, self.timeout)
'Return a :class:`PhoneNumbers` instance'
def phone_numbers(self, trunk_sid):
phone_numbers_uri = '{0}/Trunks/{1}'.format(self.trunk_base_uri, trunk_sid) return PhoneNumbers(phone_numbers_uri, self.auth, self.timeout)
'Return a :class:`Trunks` instance'
def trunks(self):
return Trunks(self.trunk_base_uri, self.auth, self.timeout)
'Mute the participant'
def mute(self):
self.update_instance(muted='true')
'Unmute the participant'
def unmute(self):
self.update_instance(muted='false')
'Remove the participant from the given conference'
def kick(self):
self.delete_instance()
'Returns a list of :class:`Participant` resources in the given conference :param conference_sid: Conference this participant is part of :param boolean muted: If True, only show participants who are muted'
def list(self, **kwargs):
return self.get_instances(kwargs)
'Mute the given participant'
def mute(self, call_sid):
return self.update(call_sid, muted=True)
'Unmute the given participant'
def unmute(self, call_sid):
return self.update(call_sid, muted=False)
'Remove the participant from the given conference'
def kick(self, call_sid):
return self.delete(call_sid)
'Remove the participant from the given conference'
def delete(self, call_sid):
return self.delete_instance(call_sid)
':param sid: Participant identifier :param boolean muted: If true, mute this participant'
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Return a list of :class:`Conference` resources :param status: Show conferences with this status :param friendly_name: Show conferences with this exact friendly_name :param date updated_after: List conferences updated after this date :param date updated_before: List conferences updated before this date :param date crea...
@normalize_dates def list(self, updated_before=None, updated_after=None, created_after=None, created_before=None, updated=None, created=None, **kwargs):
kwargs['DateUpdated'] = parse_date(kwargs.get('date_updated', updated)) kwargs['DateCreated'] = parse_date(kwargs.get('date_created', created)) kwargs['DateUpdated<'] = updated_before kwargs['DateUpdated>'] = updated_after kwargs['DateCreated<'] = created_before kwargs['DateCreated>'] = created_...
'Send an HTTP request to the resource. :raises: a :exc:`~twilio.TwilioRestException`'
def request(self, method, uri, **kwargs):
if (('timeout' not in kwargs) and (self.timeout is not UNSET_TIMEOUT)): kwargs['timeout'] = self.timeout kwargs['use_json_extension'] = self.use_json_extension resp = make_twilio_request(method, uri, auth=self.auth, **kwargs) logger.debug(resp.content) if (method == 'DELETE'): return...
'Load all subresources'
def load_subresources(self):
for resource in self.subresources: list_resource = resource(self.uri, self.parent.auth, self.parent.timeout) self.__dict__[list_resource.key] = list_resource
'Make a POST request to the API to update an object\'s properties :return: None, this is purely side effecting :raises: a :class:`~twilio.rest.RestException` on failure'
def update_instance(self, **kwargs):
a = self.parent.update(self.name, **kwargs) self.load(a.__dict__)
'Make a DELETE request to the API to delete the object :return: None, this is purely side effecting :raises: a :class:`~twilio.rest.RestException` on failure'
def delete_instance(self):
return self.parent.delete(self.name)
'Get an instance resource by its sid Usage: .. code-block:: python message = client.messages.get("SM1234") print message.body :rtype: :class:`~twilio.rest.resources.InstanceResource` :raises: a :exc:`~twilio.TwilioRestException` if a resource with that sid does not exist, or the request fails'
def get(self, sid):
return self.get_instance(sid)
'Request the specified instance resource'
def get_instance(self, sid):
uri = ('%s/%s' % (self.uri, sid)) (resp, item) = self.request('GET', uri) return self.load_instance(item)
'Query the list resource for a list of InstanceResources. Raises a :exc:`~twilio.TwilioRestException` if requesting a page of results that does not exist. :param dict params: List of URL parameters to be included in request :param int page: The page of results to retrieve (most recent at 0) :param int page_size: The nu...
def get_instances(self, params):
params = transform_params(params) (resp, page) = self.request('GET', self.uri, params=params) if (self.key not in page): raise TwilioException(('Key %s not present in response' % self.key)) return [self.load_instance(ir) for ir in page[self.key]]
'Create an InstanceResource via a POST to the List Resource :param dict body: Dictionary of POST data'
def create_instance(self, body):
(resp, instance) = self.request('POST', self.uri, data=transform_params(body)) if (resp.status_code not in (200, 201)): raise TwilioRestException(resp.status_code, self.uri, 'Resource not created') return self.load_instance(instance)
'Delete an InstanceResource via DELETE body: string -- HTTP Body for the quest'
def delete_instance(self, sid):
uri = ('%s/%s' % (self.uri, sid)) (resp, instance) = self.request('DELETE', uri) return (resp.status_code == 204)
'Update an InstanceResource via a POST sid: string -- String identifier for the list resource body: dictionary -- Dict of items to POST'
def update_instance(self, sid, body):
uri = ('%s/%s' % (self.uri, sid)) (resp, entry) = self.request('POST', uri, data=transform_params(body)) return self.load_instance(entry)
'Return all instance resources using an iterator This will fetch a page of resources from the API and yield them in turn. When the page is exhausted, this will make a request to the API to retrieve the next page. Hence you may notice a pattern - the library will loop through 50 objects very quickly, but there will be a...
def iter(self, **kwargs):
params = transform_params(kwargs) while True: (resp, page) = self.request('GET', self.uri, params=params) if (self.key not in page): raise StopIteration() for ir in page[self.key]: (yield self.load_instance(ir)) if (not page.get('next_page_uri', '')): ...
'Query the list resource for a list of InstanceResources. :param int page: The page of results to retrieve (most recent at 0) :param int page_size: The number of results to be returned.'
def list(self, **kw):
return self.get_instances(kw)
'Return all instance resources using an iterator This will fetch a page of resources from the API and yield them in turn. When the page is exhausted, this will make a request to the API to retrieve the next page. Hence you may notice a pattern - the library will loop through 50 objects very quickly, but there will be a...
def iter(self, **kwargs):
params = urlencode(transform_params(kwargs)) parsed = urlparse(self.uri) url = urlunparse(((parsed[:4] + (params,)) + (parsed[5],))) while True: (resp, page) = self.request('GET', url) key = page.get('meta', {}).get('key') if ((key is None) or (key not in page)): rais...
'Query the list resource for a list of InstanceResources. Raises a :exc:`~twilio.TwilioRestException` if requesting a page of results that does not exist. :param dict params: List of URL parameters to be included in request :param int page: The page of results to retrieve (most recent at 0) :param int page_size: The nu...
def get_instances(self, params):
params = transform_params(params) (resp, page) = self.request('GET', self.uri, params=params) key = page.get('meta', {}).get('key') if (key is None): raise TwilioException('Unable to determine resource key from response') if (key not in page): raise TwilioException(...
'Update this phone number instance. Parameters are as described in :meth:`Addresses.create`, with the exception that `iso_country` cannot be updated on an existing Address (create a new one instead).'
def update(self, **kwargs):
return self.parent.update(self.sid, kwargs)
'Create an :class:`Address`. :param str customer_name: Your customer\'s name :param str street: The number and street of your address :param str city: The city of you or your customer\'s address :param str region: The region or state :param str postal_code: The postal code of your address :param str iso_country: The IS...
def create(self, customer_name, street, city, region, postal_code, iso_country, friendly_name=None):
kwargs = {'customer_name': customer_name, 'street': street, 'city': city, 'region': region, 'postal_code': postal_code, 'iso_country': iso_country} if (friendly_name is not None): kwargs['friendly_name'] = friendly_name return self.create_instance(kwargs)
'Update an :class:`Address` with the given parameters. Parameters are described above in :meth:`create`, with the exception that `iso_country` cannot be updated on an existing Address (create a new one instead).'
def update(self, sid, **kwargs):
if ('iso_country' in kwargs): raise TwilioException('Cannot update iso_country on an existing Address') return self.update_instance(sid, kwargs)
'Delete an :class:`Address`. :param str sid: The sid of the Address to delete.'
def delete(self, sid):
return self.delete_instance(sid)
'Delete this transcription'
def delete(self):
return self.parent.delete(self.name)
'Return a list of :class:`Transcription` resources'
def list(self, **kwargs):
return self.get_instances(kwargs)
'Delete the given transcription'
def delete(self, sid):
return self.delete_instance(sid)
'Delete this recording'
def delete(self):
return self.delete_instance()
'Returns a page of :class:`Recording` resources as a list. For paging information see :class:`ListResource`. :param date after: Only list recordings logged after this datetime :param date before: Only list recordings logger before this datetime :param call_sid: Only list recordings from this :class:`Call`'
@normalize_dates def list(self, before=None, after=None, **kwargs):
kwargs['DateCreated<'] = before kwargs['DateCreated>'] = after return self.get_instances(kwargs)
'Returns an iterator of :class:`Recording` resources. :param date after: Only list recordings logged after this datetime :param date before: Only list recordings logger before this datetime'
@normalize_dates def iter(self, before=None, after=None, **kwargs):
kwargs['DateCreated<'] = before kwargs['DateCreated>'] = after return super(Recordings, self).iter(**kwargs)
'Delete the given recording'
def delete(self, sid):
return self.delete_instance(sid)
'Delete a task.'
def delete(self):
return self.parent.delete_instance(self.name)
'Update a task.'
def update(self, **kwargs):
return self.parent.update_instance(self.name, kwargs)
'Create a Task. :param attributes: Url-encoded JSON string describing the attributes of this task. This data will be passed back to the Workflow\'s AssignmentCallbackURL when the Task is assigned to a Worker. An example task: { \'task_type\': \'call\', \'twilio_call_sid\': \'...\', \'customer_ticket_number\': \'12345\'...
def create(self, attributes, workflow_sid, **kwargs):
kwargs['attributes'] = attributes kwargs['workflow_sid'] = workflow_sid return self.create_instance(kwargs)
'Delete the given task'
def delete(self, sid):
return self.delete_instance(sid)
'Update a :class:`Task` with the given parameters. All the parameters are describe above in :meth:`create`'
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Returns a page of :class:`Event` resources as a list. For paging information see :class:`NextGenListResource` :param minutes: (Optional, Default=15) Definition of the interval in minutes prior to now. :param start_date: (Optional, Default=15 minutes prior) Filter events by a start date. :param end_date: (Optional, Def...
def list(self, **kwargs):
return super(Events, self).list(**kwargs)
'Query the list resource for a list of InstanceResources. Raises a :exc:`~twilio.TwilioRestException` if requesting a page of results that does not exist. :param dict params: List of URL parameters to be included in request :param str page_token: Token of the page of results to retrieve :param int page_size: The number...
def get_instances(self, params):
return super(Events, self).get_instances(params)
'Delete a workflow.'
def delete(self):
return self.parent.delete_instance(self.name)
'Update a workflow.'
def update(self, **kwargs):
return self.parent.update_instance(self.name, kwargs)
'Create a Workflow. :param friendly_name: A string representing a human readable name for this Workflow. Examples include \'Inbound Call Workflow\' or \'2014 Outbound Campaign\'. :param configuration: JSON document configuring the rules for this Workflow. :param assignment_callback_url: A valid URL for the application ...
def create(self, friendly_name, configuration, assignment_callback_url, **kwargs):
kwargs['friendly_name'] = friendly_name kwargs['configuration'] = configuration kwargs['assignment_callback_url'] = assignment_callback_url return self.create_instance(kwargs)
'Delete the given workflow'
def delete(self, sid):
return self.delete_instance(sid)
'Update a :class:`Workflow` 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 task queue.'
def delete(self):
return self.parent.delete_instance(self.name)
'Update a task queue.'
def update(self, **kwargs):
return self.parent.update_instance(self.name, kwargs)
'Create a TaskQueue. :param friendly_name: Human readable description of this TaskQueue (for example "Support - Tier 1", "Sales" or "Escalation") :param assignment_activity_sid: ActivitySID to assign workers once a task is assigned for them. :param reservation_activity_sid: ActivitySID to assign workers once a task is ...
def create(self, friendly_name, assignment_activity_sid, reservation_activity_sid, **kwargs):
kwargs['friendly_name'] = friendly_name kwargs['assignment_activity_sid'] = assignment_activity_sid kwargs['reservation_activity_sid'] = reservation_activity_sid return self.create_instance(kwargs)
'Delete the given task queue'
def delete(self, sid):
return self.delete_instance(sid)
'Update a :class:`TaskQueue` with the given parameters. All the parameters are describe above in :meth:`create`'
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Update a reservation. :param reservation_status: Either accepted or rejected. Specifying accepted means the Worker has received the Task and will process it. Work Distribution Service will no longer consider this task eligible for assignment, and no other Worker will receive this Task. Specifying rejected means the Wo...
def update(self, **kwargs):
return self.parent.update_instance(self.name, kwargs)
'Update a :class:`Reservation` with the given parameters. :param sid: Reservation sid to update. :param reservation_status: Either accepted or rejected. Specifying accepted means the Worker has received the Task and will process it. Work Distribution Service will no longer consider this task eligible for assignment, an...
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Delete an activity.'
def delete(self):
return self.parent.delete_instance(self.name)
'Update an activity.'
def update(self, **kwargs):
return self.parent.update_instance(self.name, kwargs)
'Create an Activity. :param friendly_name: A human-readable name for the activity, such as \'On Call\', \'Break\', \'Email\', etc. Must be unique in this Workspace. These names will be used to calculate and expose statistics about workers, and give you visibility into the state of each of your workers. :param available...
def create(self, friendly_name, available):
return self.create_instance({'friendly_name': friendly_name, 'available': available})
'Delete the given activity'
def delete(self, sid):
return self.delete_instance(sid)
'Update an :class:`Activity` 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 worker.'
def delete(self):
return self.parent.delete_instance(self.name)
'Update a worker.'
def update(self, **kwargs):
return self.parent.update_instance(self.name, kwargs)
'Create a Workflow. :param friendly_name: String representing user-friendly name for the Worker. :param activity_sid: A valid Activity describing the worker\'s initial state. :param attributes: JSON object describing this worker. For example: { \'email: \'Bob@foo.com\', \'phone\': \'8675309\' }. This data will be passe...
def create(self, friendly_name, **kwargs):
kwargs['friendly_name'] = friendly_name return self.create_instance(kwargs)
'Delete the given worker'
def delete(self, sid):
return self.delete_instance(sid)
'Update a :class:`Worker` 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 workspace.'
def delete(self):
return self.parent.delete_instance(self.name)
'Update a workspace.'
def update(self, **kwargs):
return self.parent.update_instance(self.name, kwargs)
'Create a Workspace. :param friendly_name: Human readable description of this workspace (for example "Customer Support" or "2014 Election Campaign"). :param event_callback_url: If provided, the Workspace will publish events to this URL. You can use this to gather data for reporting. See Workspace Events for more inform...
def create(self, friendly_name, **kwargs):
kwargs['friendly_name'] = friendly_name return self.create_instance(kwargs)
'Delete the given workspace'
def delete(self, sid):
return self.delete_instance(sid)
'Update a :class:`Workspace` with the given parameters. All the parameters are describe above in :meth:`create`'
def update(self, sid, **kwargs):
return self.update_instance(sid, kwargs)
'Create a :class:`CallFeedback` object for the parent call. :param int quality: The score quality. Must be an int between 1 and 5. :param list issue: A list of issues. The issue types are found at the CallFeedback rest docs.'
def create(self, **kwargs):
return self.create_instance(kwargs)
'Get the feedback for this call Usage: .. code-block:: python feedback = client.calls.get("CA123").feedback print feedback.issues :rtype: :class:`~twilio.rest.resources.InstanceResource` :raises: a :exc:`~twilio.TwilioRestException` if the request fails'
def get(self, **kwargs):
params = transform_params(kwargs) (_, data) = self.request('GET', self.uri, params=params) return self.load_instance(data)
'Get the feedback summary for calls on this account Usage: .. code-block:: python summary = client.calls.summary.get() print summary.quality_score_average :rtype: :class:`~twilio.rest.resources.InstanceResource` :raises: a :exc:`~twilio.TwilioRestException` if the request fails'
def get(self, **kwargs):
params = transform_params(kwargs) (_, data) = self.request('GET', self.uri, params=params) return self.load_instance(data)
'If this call is currenlty active, hang up the call. If this call is scheduled to be made, remove the call from the queue'
def hangup(self):
a = self.parent.hangup(self.name) self.load(a.__dict__)
'If the called is queued or rining, cancel the calls. Will not affect in progress calls'
def cancel(self):
a = self.parent.cancel(self.name) self.load(a.__dict__)