from flask import Flask, render_template, request from twitch import TwitchClient from pprint import pprint import json app = Flask(__name__) app.config['DEBUG'] = True try: cred_file = open('.tcreds') except Exception as e: print(e) details = json.load(cred_file) #Setup Authed Twitch Client tclient = TwitchClient(client_id=details["client_id"], oauth_token=details["oauth"]) def get_followed(): return tclient.streams.get_followed() #Debug #for stream in streams_live: # print("%s: \t\t\t%s Logo is: %s" %(stream["channel"]["display_name"], stream["channel"]["game"],stream["channel"]["logo"])) @app.route('/') def index(): livestreamdata = get_followed() return render_template('index.html', livestreamdata=livestreamdata) if __name__ == '__main__': app.run(host='0.0.0.0')