twilio

class twilio.TwilioRestException(status, uri, msg='', code=None, method='GET')

A generic 400 or 500 level exception from the Twilio API

Parameters:
  • status (int) – the HTTP status that was returned for the exception
  • uri (str) – The URI that caused the exception
  • msg (str) – A human-readable message for the error
  • method (str) – The HTTP method used to make the request
  • code (int|None) – A Twilio-specific error code for the error. This is not available for all errors.

twilio.rest

class twilio.rest.TwilioRestClient(account=None, token=None, base='https://api.twilio.com', version='2010-04-01', timeout=<Unset Timeout Value>, request_account=None)

A client for accessing the Twilio REST API

Parameters:
dependent_phone_numbers(address_sid)

Return a DependentPhoneNumbers instance for the Address with the given address_sid

feedback(call_sid)

Return a CallFeedback instance for the Call with the given call_sid

members(queue_sid)

Return a Members instance for the Queue with the given queue_sid

participants(conference_sid)

Return a Participants instance for the Conference with given conference_sid

request(path, method=None, vars=None)

sends a request and gets a response from the Twilio REST API

Deprecated since version 3.0.

Parameters:
  • path – the URL (relative to the endpoint URL, after the /v1
  • url – the HTTP method to use, defaults to POST
  • vars – for POST or PUT, a dict of data to send
Returns:

Twilio response in XML or raises an exception on error

Raises:

a ValueError if the path is invalid

Raises:

a NotImplementedError if the method is unknown

This method is only included for backwards compatability reasons. It will be removed in a future version

class twilio.rest.TwilioTaskRouterClient(account=None, token=None, base='https://taskrouter.twilio.com', version='v1', timeout=<Unset Timeout Value>, request_account=None)

A client for accessing the Twilio TaskRouter API

Parameters:
activities(workspace_sid)

Return a Activities instance for the Activity with the given workspace_sid

events(workspace_sid)

Return a Events instance for the Event with the given workspace_sid

request(path, method=None, vars=None)

sends a request and gets a response from the Twilio REST API

Deprecated since version 3.0.

Parameters:
  • path – the URL (relative to the endpoint URL, after the /v1
  • url – the HTTP method to use, defaults to POST
  • vars – for POST or PUT, a dict of data to send
Returns:

Twilio response in XML or raises an exception on error

Raises:

a ValueError if the path is invalid

Raises:

a NotImplementedError if the method is unknown

This method is only included for backwards compatability reasons. It will be removed in a future version

reservations(workspace_sid, task_sid)

Return a Reservations instance for the Reservation with the given workspace_sid ans task_sid

task_queues(workspace_sid)

Return a TaskQueues instance for the TaskQueue with the given workspace_sid

tasks(workspace_sid)

Return a Tasks instance for the Task with the given workspace_sid

worker_reservations(workspace_sid, worker_sid)

Return a Reservations instance for the Reservation with the given workspace_sid ans worker_sid

workers(workspace_sid)

Return a Workers instance for the Worker with the given workspace_sid

workflows(workspace_sid)

Return a Workflows instance for the Workflow with the given workspace_sid