AttributeError when requesting stream resource
Curetix opened this issue · comments
Curetix commented
When requesting a stream resource, e.g. with client.streams.get_stream_by_user(someID)
, and the channel is offline, following error is thrown:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python35\lib\site-packages\twitch\api\streams.py", line 19, in get_stream_by_user
return Stream.construct_from(response['stream'])
File "C:\Python35\lib\site-packages\twitch\resources.py", line 61, in construct_from
instance.refresh_from(values)
File "C:\Python35\lib\site-packages\twitch\resources.py", line 65, in refresh_from
for key, value in six.iteritems(values.copy()):
AttributeError: 'NoneType' object has no attribute 'copy'
I guess Twitch changed something on their end, since it worked a few days ago.
Tomaž Šifrer commented
Thank you for the report! Sorry for the late response though, had my notifications turned off for some reason. I've pushed a fix and released it in a 0.2.1 bugfix version.
Changes: 6b8ea52
Looks like twitch changed how they return offline streams at some point.
Now client.streams.get_stream_by_user(someID)
will return None
when stream is offline
Let me know if you run in any more issues!