From 7587d4185152b3778deffe9392bc791c8d60191e Mon Sep 17 00:00:00 2001 From: sgoudham Date: Fri, 4 Sep 2020 09:17:03 +0100 Subject: [PATCH] No need to manually close sessions anymore --- cogs/anime.py | 5 ----- cogs/fun.py | 6 +----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/cogs/anime.py b/cogs/anime.py index dd43abfd..645f5e64 100644 --- a/cogs/anime.py +++ b/cogs/anime.py @@ -78,8 +78,6 @@ async def get_from_api(self, ctx, url): else: await self.bot.generate_embed(ctx, desc="**Something went wrong with MyWaifuList!**") - await session.close() - return _dict @@ -419,9 +417,6 @@ class Anime(Cog): else: await self.bot.generate_embed(ctx, desc="**Something went wrong with MyWaifuList!**") - # Close session - await session.close() - # As long as data is returned # Store all data from the api in dict if len(api_data["data"]) > 0: diff --git a/cogs/fun.py b/cogs/fun.py index c19905c3..e26670a5 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -349,7 +349,7 @@ class Fun(Cog): url = "https://apis.duncte123.me/kpop" async with aiohttp.ClientSession() as session: async with await session.get(url=url) as response: - # When succesful, read data from json + # When successful, read data from json if response.status == 200: kpop = await response.json() @@ -367,8 +367,6 @@ class Fun(Cog): desc="**You are being rate limited! You have spammed it too much :(**") return - await session.close() - embed = Embed(title=name, description=band, colour=self.bot.random_colour(), @@ -421,8 +419,6 @@ class Fun(Cog): desc="**You are being rate limited! You have spammed it too much :(**") return - await session.close() - # Setting bools to ticks/cross emojis verif = self.bot.tick if verified else self.bot.cross priv = self.bot.tick if private else self.bot.cross