Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_top_url_with_page_and_subtype():
assert (
utils.get_top_url(utils.BASE_URL, "Anime", page=2, subtype="upcoming")
== "https://api.jikan.moe/v3/top/anime/2/upcoming"
)
def test_get_top_url_with_page():
assert (
utils.get_top_url(utils.BASE_URL, "Anime", page=2, subtype=None)
== "https://api.jikan.moe/v3/top/anime/2"
)
def test_get_top_url():
assert (
utils.get_top_url(utils.BASE_URL, "Anime", page=None, subtype=None)
== "https://api.jikan.moe/v3/top/anime"
)
type (:obj:`str`): Type to get top items from. Possible values are
anime and manga.
page (:obj:`int`, optional): Page number of the results. Defaults to
None.
subtype (:obj:`str`, optional): Subtype to get filtered top items.
Possible values are in the Jikan API documentation. Defaults to
None.
Returns:
Dict: Dictionary containing top items on MyAnimeList.
Examples:
>>> jikan.top(type='manga')
>>> jikan.top(type='anime', page=2, subtype='upcoming')
"""
url = utils.get_top_url(self.base, type, page, subtype)
return self._request(url, type=type)
type (:obj:`str`): Type to get top items from. Possible values are
anime and manga.
page (:obj:`int`, optional): Page number of the results. Defaults to
None.
subtype (:obj:`str`, optional): Subtype to get filtered top items.
Possible values are in the Jikan API documentation. Defaults to
None.
Returns:
Dict: Dictionary containing top items on MyAnimeList.
Examples:
>>> await jikan.top(type='manga')
>>> await jikan.top(type='anime', page=2, subtype='upcoming')
"""
url = utils.get_top_url(self.base, type, page, subtype)
return await self._request(url, type=type)