i am writing a Discord bot and i just stumbled onto something i can’t figure out.
I got an API where i want to collect some data from and store it into a JSON.
The problem i am encountering is that i cannot parse the data into a JSON.
i tried this code:
@bot.command() async def main(ctx): async with aiohttp.ClientSession() as session: v1url = 'https://api.pancakeswap.info/api/tokens/0x375483cfa7fc18f6b455e005d835a8335fbdbb1f' async with session.get(v1url) as response: data1 = response.json() await ctx.send(data1)
And it gave me this error:
/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py:85: RuntimeWarning: coroutine 'ClientResponse.json' was never awaited ret = await coro(*args, **kwargs) RuntimeWarning: Enable tracemalloc to get the object allocation traceback
What can i do? i am trying to collect the following data: “price” and “price_bnb”