def get(self, gid, pid): user = authenticate(request.authorization) if not user: return auth_response() player = Player(gid, pid) if not player.exists(): return '', 404 cards = player.get_cards() response_data = player.get_data() if user.username == player.get_username(): response_data['color'] = player.get_color() return jsonify(response_data)
from models import Character, Party, Player from health_utils import get_character_health, ThrottlingException import random from werkzeug.contrib.cache import SimpleCache cache = SimpleCache() app = Flask(__name__) app.secret_key = "development" TWITCH_CLIENTID = 'CHANGEME' TWITCH_SECRET = 'CHANGEME' # Create table if it doesnt exist already. if not Player.exists(): Player.create_table(wait=True) oauth = OAuth() twitch = oauth.remote_app( 'twitch', consumer_key= TWITCH_CLIENTID, # get at: https://www.twitch.tv/kraken/oauth2/clients/new consumer_secret=TWITCH_SECRET, base_url='https://api.twitch.tv/kraken/', request_token_url=None, request_token_params={ 'scope': ["user_read", "channel_check_subscription"] }, access_token_method='POST', access_token_url='https://api.twitch.tv/kraken/oauth2/token',