'Call Zendesk API and return results
:param path: The Zendesk API to call
:param query: Query parameters
:param get_all_pages: Accumulate results over all pages before
returning. Due to strict rate limiting, this can often timeout.
Waits for recommended period between tries after a timeout.'

def call(self, path, query=None, get_all_pages=True):

    zendesk = self.get_conn()
    first_request_successful = False
    while (not first_request_successful):
        try:
            results = zendesk.call(path, query)
            first_request_successful = True
        except RateLimitError as rle:
            self.__handle_rate_limit_exception(rle)
    key = path.split('/')[(-1)].split('.json')[0]
    next_page = results['next_page']
    results = results[key]
    if get_all_pages:
        while (next_page is not None):
            try:
                next_url = next_page.split(self.__url)[1]
                logging.info('Calling    {}'.format(next_url))
                more_res = zendesk.call(next_url)
                results.extend(more_res[key])
                if (next_page == more_res['next_page']):
                    break
                else:
                    next_page = more_res['next_page']
            except RateLimitError as rle:
                self.__handle_rate_limit_exception(rle)
            except ZendeskError as ze:
                if ('Use    a    start_time    older    than    5    minutes' in ze.msg):
                    break
                else:
                    raise ze
    return results
