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_genre_url():
assert (
utils.get_genre_url(utils.BASE_URL, "Anime", 2, page=None)
== "https://api.jikan.moe/v3/genre/anime/2"
)
def test_get_genre_url_with_page():
assert (
utils.get_genre_url(utils.BASE_URL, "Anime", 2, page=2)
== "https://api.jikan.moe/v3/genre/anime/2/2"
)
Args:
type (:obj:`str`): Type to get items from. Possible values are anime
and manga.
genre_id (:obj:`int`): Genre ID from MyAnimeList.
page (:obj:`int`, optional): Page number of the results. Defaults to
None.
Returns:
Dict: Dictionary containing anime or manga by genre.
Examples:
>>> await jikan.genre(type='anime', genre_id=1)
>>> await jikan.genre(type='manga', genre_id=2)
"""
url = utils.get_genre_url(self.base, type, genre_id, page)
return await self._request(url, id=genre_id, type=type)
Args:
type (:obj:`str`): Type to get items from. Possible values are anime
and manga.
genre_id (:obj:`int`): Genre ID from MyAnimeList.
page (:obj:`int`, optional): Page number of the results. Defaults to
None.
Returns:
Dict: Dictionary containing anime or manga by genre.
Examples:
>>> jikan.genre(type='anime', genre_id=1)
>>> jikan.genre(type='manga', genre_id=2)
"""
url = utils.get_genre_url(self.base, type, genre_id, page)
return self._request(url, id=genre_id, type=type)