Seite 1 von 1

Rest API abfrage Python

Verfasst: Sonntag 18. Oktober 2020, 17:43
von Endrick
Hallo,

Ich habe eine Rest API abfrage in meinen Discordbot eingefügt jedoch bekomme ich immer Fehler.

Code: Alles auswählen

if message.content == "$help":
    async with aiohttp.ClientSession() as session:
        async with session.get('https://api.truckersmp.com/v2/servers') as resp:
            await message.channel.send(resp.status)
            await message.channel.send(resp["response"][0]["id"])

Code: Alles auswählen

   await message.channel.send(resp["response"][0]["id"])
TypeError: 'ClientResponse' object is not subscriptable