Invalid OAuth token

So what is the actual URL you are calling?

Is your code doing

r = requests.get('https://api.twitch.tv/helix/users?login=foo')

or something else?

Your error suggests that the login is not being passed correctly and as a result the oAuth token is being used to look up the user, but the token doesn’t have a user, hence the error