def _get_collection(self, url_suffix, data):
        """
        Performs GET for all pages based on x-total-pages in first response headers.
        Merges the json() 'results' arrays.
        If x-total-pages is missing or 1 just returns the response without fetching multiple pages.
        :param url_suffix: str URL path we are sending a GET to
        :param data: object data we are sending
        :return: requests.Response containing the result
        """
        response = self._get_single_page(url_suffix, data, page_num=1)
        total_pages_str = response.headers.get('x-total-pages')
        if total_pages_str:
            total_pages = int(total_pages_str)
            if total_pages > 1:
                multi_response = MultiJSONResponse(base_response=response, merge_array_field_name="results")
                for page in range(2, total_pages + 1):
                    additional_response = self._get_single_page(url_suffix, data, page_num=page)
                    multi_response.add_response(additional_response)
                return multi_response
        return response
def _get_collection ( self , url_suffix , data ) : response = self . _get_single_page ( url_suffix , data , page_num = 1 ) total_pages_str = response . headers . get ( 'x-total-pages' ) if total_pages_str : total_pages = int ( total_pages_str ) if total_pages > 1 : multi_response = MultiJSONResponse ( base_response = response , merge_array_field_name = "results" ) for page in range ( 2 , total_pages + 1 ) : additional_response = self . _get_single_page ( url_suffix , data , page_num = page ) multi_response . add_response ( additional_response ) return multi_response return response
Performs GET for all pages based on x-total-pages in first response headers.
        Merges the json() 'results' arrays.
        If x-total-pages is missing or 1 just returns the response without fetching multiple pages.
        :param url_suffix: str URL path we are sending a GET to
        :param data: object data we are sending
        :return: requests.Response containing the result