You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure why Flickr service returns multiple empty pages inside next() with the following code.
w = flickr_api.Walker(flickr_api.Photo.search, text="sydney night", license="8,9,10", media="photos")
for i, photo in enumerate(w):
<download the photo>
It crashed due to accessing empty list at around photo 728
Here is my fix:
def next(self):
if self._curr_index == len(self._curr_list):
if self._page < self._info.pages:
while self._page < self._info.pages:
self._page += 1
self.kwargs["page"] = self._page
self._curr_list = self.method(*self.args, **self.kwargs)
self._info = self._curr_list.info
self._curr_index = 0
if len(self._curr_list) == 0:
continue # here
break
if len(self._curr_list) == 0:
raise StopIteration()
else:
raise StopIteration()
curr = self._curr_list[self._curr_index]
self._curr_index += 1
return curr
The text was updated successfully, but these errors were encountered:
chcao052
changed the title
Walker's next() need to handle empty page
Walker's next() needs to handle empty page
Sep 18, 2018
chcao052
changed the title
Walker's next() needs to handle empty page
Walker's next() needs to handle empty page returned from Flickr service
Sep 18, 2018
I am not sure why Flickr service returns multiple empty pages inside next() with the following code.
It crashed due to accessing empty list at around photo 728
Here is my fix:
The text was updated successfully, but these errors were encountered: