Skip to content

Commit

Permalink
Fix: add passing viewed parameter (#247) (#262)
Browse files Browse the repository at this point in the history
Updated methods `illust_related()`, `illust_recommended()` in
`AppPixivAPI` class. Both of them have had `viewed` parameter in their
signatures but the parameter was unused.
  • Loading branch information
nautics889 authored Mar 18, 2023
1 parent 5c517c5 commit b06c06f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pixivpy3/aapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def illust_related(
filter: _FILTER = "for_ios",
seed_illust_ids: int | str | list[str] | None = None,
offset: int | str | None = None,
viewed: list[str] | None = None,
viewed: str | list[str] | None = None,
req_auth: bool = True,
) -> ParsedJson:
url = "%s/v2/illust/related" % self.hosts
Expand All @@ -275,6 +275,10 @@ def illust_related(
params["seed_illust_ids[]"] = [seed_illust_ids]
elif isinstance(seed_illust_ids, list):
params["seed_illust_ids[]"] = seed_illust_ids
if isinstance(viewed, str):
params["viewed[]"] = [viewed]
elif isinstance(viewed, list):
params["viewed[]"] = viewed
r = self.no_auth_requests_call("GET", url, params=params, req_auth=req_auth)
return self.parse_result(r)

Expand All @@ -291,7 +295,7 @@ def illust_recommended(
include_ranking_illusts: str | bool | None = None,
bookmark_illust_ids: str | list[int | str] | None = None,
include_privacy_policy: str | list[int | str] | None = None,
viewed: list[str] | None = None,
viewed: str | list[str] | None = None,
req_auth: bool = True,
) -> ParsedJson:
if req_auth:
Expand All @@ -315,6 +319,10 @@ def illust_recommended(
params["include_ranking_illusts"] = self.format_bool(
include_ranking_illusts
)
if isinstance(viewed, str):
params["viewed[]"] = [viewed]
elif isinstance(viewed, list):
params["viewed[]"] = viewed

if not req_auth:
if isinstance(bookmark_illust_ids, str):
Expand Down

0 comments on commit b06c06f

Please sign in to comment.