paperswithcode/paperswithcode-client

Cannot fetch more pages of area task list

lambdaofgod opened this issue · 2 comments

client.area_task_list("computer-vision") works fine, whereas

client.area_task_list("computer-vision", page=2) throws


---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-82-e71e2ef59317> in <module>
----> 1 client.area_task_list("computer-vision", page=2)

~/.local/lib/python3.8/site-packages/tea_client/handler.py in wrapper(self, *args, **kwargs)
     16     def wrapper(self, *args, **kwargs):
     17         try:
---> 18             return func(self, *args, **kwargs)
     19         except HttpClientError as e:
     20             if e.status_code == 401:

~/.local/lib/python3.8/site-packages/paperswithcode/client.py in area_task_list(self, area_id, page, items_per_page)
    334             Tasks: Tasks object.
    335         """
--> 336         return self.__page(
    337             self.http.get(
    338                 f"/areas/{area_id}/tasks/",

~/.local/lib/python3.8/site-packages/paperswithcode/client.py in __page(cls, result, page_model)
     79         previous_page = result["previous"]
     80         if previous_page is not None:
---> 81             previous_page = cls.__parse(previous_page)
     82         return page_model(
     83             count=result["count"],

~/.local/lib/python3.8/site-packages/paperswithcode/client.py in __parse(url)
     70         else:
     71             q = parse.parse_qs(p.query)
---> 72             return q["page"][0]
     73 
     74     @classmethod

KeyError: 'page'

This should not happen, as results of first query say there exists next page, and also it says that there are 934 results for computer vision, but maximal number of retrieved results is 500.

Hi Jakub, I think you are using an older version of the client, can you recheck with 0.3.1?

It works. Thanks!