Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fetch_markers passing list instead of dict #451

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

Zarithya
Copy link
Contributor

@Zarithya Zarithya commented May 21, 2024

Description

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:

    self.markers = [Marker(d) for d in data["markers"]]
                                       ~~~~^^^^^^^^^^^
TypeError: list indices must be integers or slices, not str

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
    • I have updated the changelog with a quick recap of my changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)
  • I have read and agree to the Developer Certificate of Origin for this contribution

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```
@chillymosh chillymosh added bug HTTP HTTP Endpoint related items. 2.0 TwitchIO 2.0 labels May 21, 2024
Copy link
Collaborator

@chillymosh chillymosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@IAmTomahawkx IAmTomahawkx changed the base branch from master to maintain/2.x May 22, 2024 18:58
@IAmTomahawkx IAmTomahawkx merged commit ad580de into PythonistaGuild:maintain/2.x Jun 18, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 TwitchIO 2.0 bug HTTP HTTP Endpoint related items.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants