Skip to content

Commit

Permalink
Fix pagination parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
0x16c3 committed Jan 18, 2022
1 parent 3b5eb49 commit 3b4da4b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
16 changes: 12 additions & 4 deletions anilist/async_client.py
Expand Up @@ -116,7 +116,9 @@ async def search(
else:
raise TypeError("There is no such content type.")

return search if not pagination else search, pages
if pagination:
return search, pages
return search

async def get(
self,
Expand Down Expand Up @@ -179,12 +181,16 @@ async def get(
anime, pages = await self.get_list(
user_id=id, limit=limit, page=page, content_type="anime"
)
return anime if not pagination else anime, pages
if pagination:
return anime, pages
return anime
elif content_type == "list_manga":
manga, pages = await self.get_list(
user_id=id, limit=limit, page=page, content_type="manga"
)
return manga if not pagination else manga, pages
if pagination:
return manga, pages
return manga
elif content_type == "user":
raise TypeError("id argument must be a string for the user object.")
else:
Expand Down Expand Up @@ -1078,7 +1084,9 @@ async def get_activity(
elif content_type == "message":
return await self.get_message_activity(user_id=id, page=page, limit=limit)

return activity if not pagination else activity, pages
if pagination:
return activity, pages
return activity

async def get_anime_activity(
self, user_id: int, limit: int, page: int = 1
Expand Down
16 changes: 12 additions & 4 deletions anilist/sync_client.py
Expand Up @@ -112,7 +112,9 @@ def search(
else:
raise TypeError("There is no such content type.")

return search if not pagination else search, pages
if pagination:
return search, pages
return search

def get(
self,
Expand Down Expand Up @@ -174,12 +176,16 @@ def get(
anime, pages = self.get_list(
user_id=id, limit=limit, page=page, content_type="anime"
)
return anime if not pagination else anime, pages
if pagination:
return anime, pages
return anime
elif content_type == "list_manga":
manga, pages = self.get_list(
user_id=id, limit=limit, page=page, content_type="manga"
)
return manga if not pagination else manga, pages
if pagination:
return manga, pages
return manga
elif content_type == "user":
raise TypeError("id argument must be a string for the user object.")
else:
Expand Down Expand Up @@ -1004,7 +1010,9 @@ def get_activity(
elif content_type == "message":
return self.get_message_activity(user_id=id, page=page, limit=limit)

return activity if not pagination else activity, pages
if pagination:
return activity, pages
return activity

def get_anime_activity(
self, user_id: int, limit: int, page: int = 1
Expand Down

0 comments on commit 3b4da4b

Please sign in to comment.