import logging
import os

from twilio import TwilioException
from twilio.rest.resources import Accounts
from twilio.rest.resources import Applications
from twilio.rest.resources import Calls
from twilio.rest.resources import CallerIds
from twilio.rest.resources import Notifications
from twilio.rest.resources import Recordings
from twilio.rest.resources import Transcriptions
from twilio.rest.resources import Sms
from twilio.rest.resources import PhoneNumbers
from twilio.rest.resources import Conferences
from twilio.rest.resources import Sandboxes
from urllib import urlencode
from urlparse import urljoin


def find_credentials():
    """
    Look in the current environment for Twilio credentails
    """
    try:
        account = os.environ["TWILIO_ACCOUNT_SID"]
        token = os.environ["TWILIO_AUTH_TOKEN"]
        return account, token
    except KeyError:
        return None, None


class TwilioRestClient(object):
    """
    A client for accessing the Twilio REST API
    """

    def request(self, *args, **kwargs):
        pass

    def __init__(self, account=None, token=None, base="https://api.twilio.com",
                 version="2010-04-01", client=None):
        """
        Create a Twilio REST API client.
        """

        # Get account credentials
        if not account or not token:
            account, token = find_credentials()
            if not account or not token:
                raise TwilioException("Could not find account credentials")

        auth = (account, token)
        version_uri = "%s/%s" % (base, version)
        account_uri = "%s/%s/Accounts/%s" % (base, version, account)

        self.accounts = Accounts(version_uri, auth)
        self.applications = Applications(account_uri, auth)
        self.calls = Calls(account_uri, auth)
        self.caller_ids = CallerIds(account_uri, auth)
        self.notifications = Notifications(account_uri, auth)
        self.recordings = Recordings(account_uri, auth)
        self.transcriptions = Transcriptions(account_uri, auth)
        self.sms = Sms(account_uri, auth)
        self.phone_numbers = PhoneNumbers(account_uri, auth)
        self.conferences = Conferences(account_uri, auth)
        self.sandboxes = Sandboxes(account_uri, auth)

@@ -18,17 +18,16 @@
 port os%0A
-%0A
 from twi
@@ -53,16 +53,63 @@
 ception%0A
+from twilio.rest.resources import make_request%0A
 from twi
@@ -1059,38 +1059,1488 @@
 lf, 
-*args, **kwargs):%0A        pass
+path, method=None, vars=None):%0A        %22%22%22sends a request and gets a response from the Twilio REST API%0A%0A        .. deprecated:: 3.0%0A%0A        path: the URL (relative to the endpoint URL, after the /v1%0A        url: the HTTP method to use, defaults to POST%0A        vars: for POST or PUT, a dict of data to send%0A%0A        returns Twilio response in XML or raises an exception on error%0A%0A        This method is only included for backwards compatability reasons.%0A        It will be removed in a future version%0A        %22%22%22%0A        logging.warning(%22:meth:%60TwilioRestClient.request%60 is deprecated and %22%0A                        %22will be removed in a future version%22)%0A%0A        vars = vars or %7B%7D%0A        params = None%0A        data = None%0A%0A        if not path or len(path) %3C 1:%0A            raise ValueError('Invalid path parameter')%0A        if method and method not in %5B'GET', 'POST', 'DELETE', 'PUT'%5D:%0A            raise NotImplementedError(%0A                'HTTP %25s method not implemented' %25 method)%0A%0A        if path%5B0%5D == '/':%0A            uri = _TWILIO_API_URL + path%0A        else:%0A            uri = _TWILIO_API_URL + '/' + path%0A%0A        if method == %22GET%22:%0A            params = vars%0A        elif method == %22POST%22 or method == %22PUT%22:%0A            data = vars%0A%0A        headers = %7B%0A            %22User-Agent%22: %22twilio-python%22,%0A            %7D%0A%0A        resp = make_request(method, uri, auth=self.auth, data=data,%0A                            params=params, headers=headers)%0A%0A        return resp.content
 %0A%0A  
@@ -2973,24 +2973,24 @@
 ials%22)%0A%0A
-
         
 auth = (
@@ -2981,16 +2981,21 @@
         
+self.
 auth = (

Add the start of backwards compatible support