[Python] Function to get Twitch Channel ID

Scope is defined when you’re generating an OAuth token as described in the authentication guide. I would highly recommend reading that and spend some time learning OAuth if you’re unfamiliar with it.

As stated in the documentation, https://api.twitch.tv/kraken/channel needs the channel_read scope. Your token, as you saw, only has the chat_login scope. You’ll need to generate a new token with the channel_read scope and pass that into your original code.