'Wrapper around requests.request()
Prepends BASE_URL to path.
Inserts oauth_token to query params.
Parses response as JSON and returns it.'

def request(self, path, method='GET', params=None, data=None, files=None, headers=None, raw=False, allow_redirects=True, stream=False):

    if (not params):
        params = {}
    if (not headers):
        headers = {}
    params['oauth_token'] = self.access_token
    headers['Accept'] = 'application/json'
    if path.startswith('https://'):
        url = path
    else:
        url = (BASE_URL + path)
    log.debug('url:    %s', url)
    response = self.session.request(method, url, params=params, data=data, files=files, headers=headers, allow_redirects=allow_redirects, stream=stream)
    log.debug('response:    %s', response)
    if raw:
        return response
    log.debug('content:    %s', response.content)
    try:
        body = json.loads(response.content.decode())
    except ValueError:
        raise ServerError('InvalidJSON', response.content)
    if (body['status'] == 'ERROR'):
        log.error('API    returned    error:    %s', body)
        exception_class = {'4': ClientError, '5': ServerError}[str(response.status_code)[0]]
        raise exception_class(body['error_type'], body['error_message'])
    return body
