def make_twilio_request(method, uri, **kwargs):
 headers = kwargs.get('headers', {})
 user_agent = ('twilio-python/%s (Python %s)' % (__version__, platform.python_version()))
 headers['User-Agent'] = user_agent
 headers['Accept-Charset'] = 'utf-8'
 if ((method == 'POST') and ('Content-Type' not in headers)):
  headers['Content-Type'] = 'application/x-www-form-urlencoded'
 kwargs['headers'] = headers
 if ('Accept' not in headers):
  headers['Accept'] = 'application/json'
 if kwargs.pop('use_json_extension', False):
  uri += '.json'
 resp = make_request(method, uri, **kwargs)
 if (not resp.ok):
  try:
   error = json.loads(resp.content)
   code = error['code']
   message = error['message']
  except:
   code = None
   message = resp.content
  raise TwilioRestException(status=resp.status_code, method=method, uri=resp.url, msg=message, code=code)
 return resp

def make_twilio_request ( method , uri , ** kwargs ) : headers = kwargs . get ( 'headers' , { } ) user_agent = ( 'twilio-python/%s (Python %s)' % ( __version__ , platform . python_version ( ) ) ) headers [ 'User-Agent' ] = user_agent headers [ 'Accept-Charset' ] = 'utf-8' if ( ( method == 'POST' ) and ( 'Content-Type' not in headers ) ) : headers [ 'Content-Type' ] = 'application/x-www-form-urlencoded' kwargs [ 'headers' ] = headers if ( 'Accept' not in headers ) : headers [ 'Accept' ] = 'application/json' if kwargs . pop ( 'use_json_extension' , False ) : uri += '.json' resp = make_request ( method , uri , ** kwargs ) if ( not resp . ok ) : try : error = json . loads ( resp . content ) code = error [ 'code' ] message = error [ 'message' ] except : code = None message = resp . content raise TwilioRestException ( status = resp . status_code , method = method , uri = resp . url , msg = message , code = code ) return resp
make a request to twilio .