diff --git a/fastanime/libs/anilist/api.py b/fastanime/libs/anilist/api.py index 49a7d88..4cc767c 100644 --- a/fastanime/libs/anilist/api.py +++ b/fastanime/libs/anilist/api.py @@ -98,7 +98,10 @@ class AniListApi: headers=self.headers, ) anilist_data = response.json() - return (True, anilist_data) + if response.status_code == 200: + return (True, anilist_data) + else: + return (False, anilist_data) except requests.exceptions.Timeout: return ( False, @@ -142,7 +145,11 @@ class AniListApi: timeout=10, ) anilist_data: AnilistDataSchema = response.json() - return (True, anilist_data) + + if response.status_code == 200: + return (True, anilist_data) + else: + return (False, anilist_data) except requests.exceptions.Timeout: return ( False, diff --git a/fastanime/libs/anilist/queries_graphql.py b/fastanime/libs/anilist/queries_graphql.py index 172472f..bdbbfc0 100644 --- a/fastanime/libs/anilist/queries_graphql.py +++ b/fastanime/libs/anilist/queries_graphql.py @@ -9,30 +9,56 @@ mutation{ unreadNotificationCount } } +""" +reviews_query = """ +query($id:Int){ + Page{ + pageInfo{ + total + } + + reviews(mediaId:$id){ + summary + user{ + name + avatar { + large + medium + } + } + body + + } + } +} + """ notification_query = """ query{ Page { pageInfo { - total + total } notifications(resetNotificationCount:true,type:AIRING) { - ... on AiringNotification { - id - type - episode - contexts - createdAt - media { - id - title { - romaji - english - } + ... on AiringNotification { + id + type + episode + contexts + createdAt + media { + id + title { + romaji + english + } + coverImage{ + medium + } + } } } - } - } + } } """