From 842cdeb9b9bf05f0d3ef55e521665a35852f5aff Mon Sep 17 00:00:00 2001 From: Strix Date: Thu, 10 Apr 2025 02:36:17 +0200 Subject: [PATCH] fix: twitch oauth --- stats/twitch_stats.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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)