This commit is contained in:
fomys 2019-05-09 01:45:38 +02:00
parent bc213e65f0
commit f878bf87b1
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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: