Answer the question
In order to leave comments, you need to log in
How to get data from API and output as a list?
I have an api with users and statistics: 21.rainixgdps.com/database/api/getTop.php
how to take 'stars', 'userName', 'pos' from this api and output it as a kind of top of players like:
with aiohttp!
The MAXIMUM that I came up with is this
async with aiohttp.ClientSession() as session:
req = f"https://21.rainixgdps.com/database/api/getTop.php"
response = await session.get(req)
res = await response.json(content_type='text/html')
emb = discord.Embed(description =
f"""**────────────────────**
f"{res['pos'][0]}: {res['userName'][0]} : {res['stars'][0]} :star:"
""")
emb.set_author(name="Top 10 player by stars")
await ctx.reply(embed=emb, mention_author=False)
Extra data: line 1 column 61 (char 60)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question