Follow another user using Twitch api v5

def followChannel(name):
    username, userId = user(oauth)
    channelId = getChannelId(name)

    URL = f"https://api.twitch.tv/helix/users/follows?from_id={userId}&to_id={channelId}"
    Headers = {"Accept": "application/vnd.twitchtv.v5+json", "Client-ID": clientId, "Authorization": "Bearer 
    " + oauth}

    r = requests.get(URL, headers=Headers)

    data = r.json()
    print(data)

I tried using this code to follow a user but it didn’t work. I get this response:
{'total': 0, 'data': [], 'pagination': {}}
How do you follow another account using the twitch api?

@BarryCarlyon

No need to ping barry about this :wink:

As per the Docs you need to send a POST request for this, not GET - change your requests.get to requests.post and, if you have the correct scopes and token, it should work.

Also, you are sending the v5/kraken Accept header - you don’t need that when using Helix.

Duplicate of

and

Additionally you say “v5” in the topic but called helix

Closing as a duplicate.