tsifrer / python-twitch-client

Python wrapper for Twitch API

Home Page:http://python-twitch-client.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

channels.update() not working (HTTP error 400)

m3adow opened this issue · comments

Hey, after fixing #8 I tried updating my stream title. Unfortunately there seems to be an error. Reproducable script:

oauth = 'yourid'
client_id = 'yourclientid'
newstatus='There is now cow level'

tc = TwitchClient(client_id=client_id, oauth_token=oauth)
tc.channels.update(channel_id=tc.channels.get()['id'], status=newstatus)

This will return a requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.twitch.tv/kraken/channels/XXXXXX. The error message is Missing required parameter channel.

This is because the body status=newstatus is sent instead of channel[status]=status here: https://github.com/tsifrer/python-twitch-client/blob/master/twitch/api/channels.py#L22

I've already found a (dirty) workaround by changing the keys of data to include channel (like this: data['channel[status]'] = status) but it's neither tested thoroughly nor is it a good way in my eyes.

Thanks for the report and nice issue writeup. This is now fixed in version 0.3.0

Let me know if you run in any more problems!