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_schedule_url_with_day():
assert (
utils.get_schedule_url(utils.BASE_URL, "Tuesday")
== "https://api.jikan.moe/v3/schedule/tuesday"
)
def test_get_schedule_url():
assert (
utils.get_schedule_url(utils.BASE_URL, day=None)
== "https://api.jikan.moe/v3/schedule"
)
def schedule(self, day: Optional[str] = None) -> Dict[str, Any]:
"""Gets anime scheduled.
Args:
day (:obj:`str`, optional): Day of the week to get the scheduled
anime. Defaults to None.
Returns:
Dict: Dictionary containing anime scheduled.
Examples:
>>> jikan.schedule()
>>> jikan.schedule(day='monday')
"""
url = utils.get_schedule_url(self.base, day)
return self._request(url, day=day)
async def schedule(self, day: Optional[str] = None) -> Dict[str, Any]:
"""Gets anime scheduled.
Args:
day (:obj:`str`, optional): Day of the week to get the scheduled
anime. Defaults to None.
Returns:
Dict: Dictionary containing anime scheduled.
Examples:
>>> await jikan.schedule()
>>> await jikan.schedule(day='monday')
"""
url = utils.get_schedule_url(self.base, day)
return await self._request(url, day=day)