From f878bf87b105f59b139ef8dc325a26798a18f958 Mon Sep 17 00:00:00 2001 From: fomys Date: Thu, 9 May 2019 01:45:38 +0200 Subject: [PATCH] Commit --- modules/modules/__init__.py | 2 +- modules/modules/api.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/modules/__init__.py b/modules/modules/__init__.py index d1a99f6..2661335 100644 --- a/modules/modules/__init__.py +++ b/modules/modules/__init__.py @@ -113,7 +113,7 @@ class MainClass(BaseClass): await message.channel.send(embed=embed) async def com_web_list(self, message, args, kwargs): - modules = self.api.list() + modules = await self.api.list() text = "" for module, versions in modules.items(): text += module + " - " + ", ".join(versions) diff --git a/modules/modules/api.py b/modules/modules/api.py index af30000..4943cd2 100644 --- a/modules/modules/api.py +++ b/modules/modules/api.py @@ -9,12 +9,14 @@ class Api: self.host = host self.basepath = "http://"+host+"/api/current" - def _get(self, endpoint): + async def _get(self, endpoint): + if endpoint[0] != "/": + endpoint = "/" + endpoint async with aiohttp.ClientSession() as session: async with session.get(self.basepath+endpoint) as response: return await response.json() - def _download(self, endpoint, filename="temp"): + async def _download(self, endpoint, filename="temp"): if endpoint[0] != "/": endpoint = "/" + endpoint async with aiohttp.ClientSession() as session: