diff --git a/stats/twitch_stats.py b/stats/twitch_stats.py index c509ece..a032b70 100644 --- a/stats/twitch_stats.py +++ b/stats/twitch_stats.py @@ -42,13 +42,14 @@ def get_token(): _token_cache["expires_at"] = time.time() + data["expires_in"] return _token_cache["access_token"] -headers = { - 'Client-ID': TWITCH_CLIENT_ID, - 'Authorization': f'Bearer {get_token()}' -} + def update(): for channel in CHANNELS: + headers = { + 'Client-ID': TWITCH_CLIENT_ID, + 'Authorization': f'Bearer {get_token()}' + } url = f'https://api.twitch.tv/helix/streams?user_login={channel}' try: response = requests.get(url, headers=headers)