Skip to content

Commit ad580de

Browse files
Fix fetch_markers passing list instead of dict (#451)
* Update user.py The Twitch API describes the "videos" element in the response as "A list of videos that contain markers. The list contains a single video." Currently, that list is being passed when creating the VideoMarkers object, when only the first element of that "list" should be. This fixes this issue that arises when retrieving markers: ``` File "C:\Users\Zari\AppData\Roaming\Python\Python312\site-packages\twitchio\models.py", line 814, in __init__ self.markers = [Marker(d) for d in data["markers"]] ~~~~^^^^^^^^^^^ TypeError: list indices must be integers or slices, not str``` * Update changelog.rst * Update changelog.rst --------- Co-authored-by: Tom <[email protected]>
1 parent a5585de commit ad580de

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/changelog.rst

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
2.10.0
44
=======
5+
- TwitchIO
6+
- Bug fixes
7+
- fix: :func:`~twitchio.PartialUser.fetch_markers` was passing list of one element from payload, now just passes element
58
- ext.eventsub
69
- Additions
710
- Added :method:`Twitchio.ext.eventsub.EventSubClient.subscribe_channel_unban_request_create <EventSubClient.subscribe_channel_unban_request_create>` /

twitchio/user.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ async def fetch_markers(self, token: str, video_id: str = None):
770770

771771
data = await self._http.get_stream_markers(token, user_id=str(self.id), video_id=video_id)
772772
if data:
773-
return VideoMarkers(data[0]["videos"])
773+
return VideoMarkers(data[0]["videos"][0])
774774

775775
async def fetch_extensions(self, token: str):
776776
"""|coro|

0 commit comments

Comments
 (0)