link = 'https://api.twitch.tv/kraken/streams/?channel=' + temp
accept = 'application/vnd.twitchtv.v5+json'
client_id = 'xxxxxxxxxxxxxxxxxxxxxxx'
async with aiohttp.ClientSession() as session:
async with session.get(link, headers={'Client-ID': client_id, 'Accept': accept}) as r:
if r:
rj = await r.json(content_type=None)
if rj['streams']:
Sometimes I get this error KeyError: 'streams', why is that? Should this request return always the streams array? I’m having this error in these last few days, never had problem of this kind in past months.