Advertisement
feasel

Setting the title via twitch API

Oct 20th, 2019
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. headers = {
  2. 'Accept': 'application/vnd.twitchtv.v5+json',
  3. 'Client-ID': '123456789',
  4. 'Authorization': 'OAuth 123456789123456789123456789',
  5. }
  6.  
  7. data = [
  8. ('channel[status]', 'This is the stream title!'),
  9. ('channel[game]', 'The Legend of Zelda: A Link to the Past'),
  10. ]
  11.  
  12. try:
  13. url = 'https://api.twitch.tv/kraken/channels/%s' % channelids[channel]
  14. response = requests.request('PUT', url, data=data, headers=headers)
  15.  
  16. print((response.text, url))
  17. if response.status_code == 200:
  18. print("Success!")
  19. except Exception as e:
  20. print("EXCEPTION RAISED in reqeusts.request()")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement