· 7 years ago · Mar 25, 2018, 03:50 PM
1@app.route('/mixer/setchannelgame/<string:game_typeId>/<string:title>')
2def m_set_channel_game(game_typeId, title):
3 conn = sqlite3.connect('F:\DB\dEngine.db')
4 c = conn.cursor()
5 c.execute('SELECT key FROM security_keys WHERE catagory = "mixer" and name = "oauthToken"')
6 mixeroauth = c.fetchone()
7 conn.close()
8
9 # https://mixer.com/api/v1/types?limit=10&noCount=1&scope=all&query=Division
10 # https://mixer.com/api/v1/types?where=name:eq:ark:%20survival%20evolved
11 #set the payload with game as typeId and title and name (mixer wierdness)
12 #payload = {'typeId': int(game_typeId), 'name': title}
13 payload = {'typeId': 876}
14
15 #send the payload
16 r = requests.patch(
17 'https://mixer.com/api/v1/channels/24552781',
18 data=json.dumps(payload),
19 params=None,
20 headers={
21 'Authorization': 'Bearer eNfOUqIHTdB8BC6GcrchXUocTFo9oK2QfV8i4uwYlkQX5MruuVU4d7CWU7F8UmMg',
22 'Content-Type': 'application/json'})
23
24 #check the result
25 # s = requests.Session()
26 # channel_response = s.get('https://mixer.com/api/v1/channels/24552781')
27
28 # channel_game = channel_response.json()['type']['name']
29 # viewers = channel_response.json()['viewersCurrent']
30 # channel_title = channel_response.json()['name']
31
32 # print("You have {} viewers...".format(viewers))
33 # print("Channel Game: {}".format(channel_game))
34 # print("Channel Title: {}".format(channel_title))
35 return ""