`!live` broken because `_total` is missing
Closed this issue · 4 comments
andreasots commented
This is also affecting eris: andreasots/eris#974.
Log fragment:
[2020-06-27 21:53:36,635] INFO:command_parser:Command from qrpth: !live
[2020-06-27 21:53:36,664] DEBUG:common.http:GET 'https://api.twitch.tv/kraken/streams/followed'{'offset': 0, 'limit': 25}...
[2020-06-27 21:53:36,901] ERROR:utils:Exception in future
Traceback (most recent call last):
File "/srv/lrrbot/lrrbot/common/utils.py", line 245, in check_exception
future.result()
File "/srv/lrrbot/lrrbot/common/utils.py", line 156, in wrapper
return (await func(*args, **kwargs))
File "/srv/lrrbot/lrrbot/lrrbot/decorators.py", line 160, in wrapper
return await func(self, conn, event, respond_to, *args, **kwargs)
File "/srv/lrrbot/lrrbot/lrrbot/commands/live.py", line 62, in live
streams = await twitch.get_streams_followed()
File "/srv/lrrbot/lrrbot/common/twitch.py", line 316, in get_streams_followed
return await utils.async_to_list(get_paginated_by_offset("https://api.twitch.tv/kraken/streams/followed", 'streams', headers=headers))
File "/srv/lrrbot/lrrbot/common/utils.py", line 380, in async_to_list
async for i in aiter:
File "/srv/lrrbot/lrrbot/common/twitch.py", line 124, in __anext__
self.total = res['_total']
KeyError: '_total'
mrphlip commented
I don't know that "Twitch pls" is fair, iirc _total
is an undocumented property here, they're allowed to get rid of it. Though it does mean we'll need a different way to be able to tell when the pagination ends...
andreasots commented
It looks like it used to be documented (https://web.archive.org/web/20191223083704/https://dev.twitch.tv/docs/v5/reference/streams#get-followed-streams) and now it's just gone.
andreasots commented
There seems to have been an announcement back in February: https://discuss.dev.twitch.tv/t/upcoming-changes-to-the-streams-v5-endpoints/23926
andreasots commented
Fixed in 6795f65.