From 060b10814b7b8fa6f3ffc0bf757867861a9236be Mon Sep 17 00:00:00 2001 From: Mitchell Klijs Date: Fri, 27 Apr 2018 10:03:32 +0200 Subject: [PATCH] Default to the first authenticated user if the list's user is not found --- media/trakt.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/media/trakt.py b/media/trakt.py index 832c89d..3dc24b8 100644 --- a/media/trakt.py +++ b/media/trakt.py @@ -161,9 +161,11 @@ class Trakt: def oauth_headers(self, user): headers = self.headers - if user is None: - users = self.cfg['trakt'] + if user is None or user not in self.cfg['trakt'].keys(): + log.debug('No authenticated user corresponds to "%s", so the first user in the config to authenticated.', user) + users = self.cfg['trakt'] + if 'api_key' in users.keys(): users.pop('api_key')