[Python] Change the stream title

Hi. I apologize for my bad English.
I am trying to make a command to change the title of a stream, but this fails. I gave the bot appropriate access (channel_editor) and when I send the request, I get a 200 response, but the stream title still does not change.

I have already tried many ways that I myself have invented or found on the Internet, and now I have this code:

url = “https://api.twitch.tv/kraken/channels/” + CHANNEL_ID
headers =
{
‘Accept’: ‘application/vnd.twitchtv.v5+json’,
“Client-ID”: BOT_CLIENT_ID,
“Authorization”: "OAuth " + BOT_OAUTH
}
data = ‘{“channel”: {“status”: “New Title”}}’
response = requests.put(url=url, headers=headers, params=data)
print(response) # <Response [200]>

What am I doing wrong?
I would be very grateful if you provided an example of a working code (I do not know much English and the official twitch documentation is rather confusing for me when it comes to requests, but I could not find decent documentation in my native language).

This is resolved.

My mistake was that I generated a token with access on behalf of the bot, and not on behalf of my channel.

The working version of the code looks like this:

url = "https://api.twitch.tv/kraken/channels/" + TWITCH_CHANNEL_ID
headers = \
{
	'Accept': 'application/vnd.twitchtv.v5+json',
	"Client-ID": BOT_CLIENT_ID,
	"Authorization": "OAuth " + AUTH_TOKEN,
	"Content-Type": "application/json"
}
data = '{"channel": {"status":"New Title"}}'
response = requests.put(url=url, headers=headers, data=data.encode('utf-8')).json()

I’m repeat that for the query to work correctly, it is necessary to generate AUTH_TOKEN on behalf of the streamer, the data of which needs to be changed, allowing access to “channel_editor”, and not on behalf of the bot account.

And once again I apologize for my English =)
Closed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.