PetterKraabol / Twitch-Python

Object-oriented Twitch API for Python developers
https://pypi.org/project/twitch-python
MIT License
214 stars 37 forks source link

Get user who owns bearer token with Helix API #8

Open alexf91 opened 5 years ago

alexf91 commented 5 years ago

The Twitch API returns the user who owns the bearer token when no arguments are provided to https://api.twitch.tv/helix/users.

If neither a user ID nor a login name is specified, the user is looked up by Bearer token. https://dev.twitch.tv/docs/api/reference/#get-users

This is currently not possible, because of this check: https://github.com/PetterKraabol/Twitch-Python/blob/104c0bc0c8dbb3a1292a45a4d0838cc8222aba82/twitch/helix/resources/users.py#L44

To keep the API consistent, this behavior should probably only be added for Helix.user() and not to Helix.users(). This way there is no confusion when an empty user list is requested. Otherwise, an empty user list could return a non-empty result.

I have implemented it here, but it seems a bit hacky: https://github.com/PetterKraabol/Twitch-Python/compare/master...alexf91:current_user

lebedynskyi commented 2 years ago

Seems no progress here..