I’m trying check my channel’s subscribers.
The documentation to do this is here:
For example, this is the URL.
https://api.twitch.tv/kraken/channels/129454141/subscriptions
I am using Python, and in order to do most API calls I append the string “?client_id=abcdefghijklmnopqrstuvwxyz” to the URL, and then go to this URL, convert the read result to dictoinary and get the value I’m interested in.
Subscriptions also require an oauth token to access. I have this (generated by the channel i’m developing this for). Is it possible to append this to the url similarly to how I have done for the client-id? e.g. “https://api.twitch.tv/kraken/channels/129454141/subscriptions?client_id=abcdefghijklmnopqrstuvwxyz?oath=abcdefghijklmnopqrstuvwxyz ”
Thank you for your time and help!
dhQk
September 24, 2017, 8:49am
2
You need to pass these in the headers, im no python programmer but according to http://docs.python-requests.org/en/latest/user/quickstart/#custom-headers
Your code for the get should be similar too:
url = 'https://api.twitch.tv/kraken/channels/129454141/subscriptions'
headers = {'Accept': 'application/vnd.twitchtv.v5+json', 'Client-ID': 'uo6dggojyb8d6soh92zknwmi5ej1q2', 'Authorization': 'OAuth cfabdegwdoklmawdzdo98xt2fo512y'}
r = requests.get(url, headers=headers)
Alca
September 24, 2017, 9:39am
3
I recommend using headers, but yes you can use the “oauth_token” key to use a token just like the client ID.
v3
/kraken/channels/:channel login /subscriptions
?api_version=3 &client_id=:client ID
&oauth_token=:OAuth token
v5
/kraken/channels/:channel ID /subscriptions
?api_version=5 &client_id=:client ID
&oauth_token=:OAuth token
I haven’t tested much of the new API, it may or may not be available there. Again, best to the learn to use headers.
system
Closed
October 24, 2017, 9:40am
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.