I am creating an application that retrieves data from the google books API. At the very beginning I download a number of books from JSON ["totalItems"] and iterate through the for loop, calling the API in order to get another 40 items. The problem is that the number of books increases and decreases during iteration, so when, for example, on a 550 book, I get a list index out of range error. Anyone please help me download all the books?
My request looks like this:
requests.get(f'https://www.googleapis.com/books/v1/volumes?q={search}\
&maxResults=40&startIndex={end_range}')
end_range is increased by 40 each time data is downloaded.