From 781ed66357b9a39a6bb3f49472bf2719173f07ac Mon Sep 17 00:00:00 2001 From: krateng Date: Wed, 6 Apr 2022 22:51:14 +0200 Subject: [PATCH] Fixed audioscrobbler APIs --- maloja/apis/audioscrobbler.py | 3 ++- maloja/apis/audioscrobbler_legacy.py | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/maloja/apis/audioscrobbler.py b/maloja/apis/audioscrobbler.py index a7219ef..586f2c5 100644 --- a/maloja/apis/audioscrobbler.py +++ b/maloja/apis/audioscrobbler.py @@ -55,7 +55,8 @@ class Audioscrobbler(APIHandler): raise InvalidAuthException() # or username and token (deprecated by lastfm) elif user is not None and token is not None: - for client,key in apikeystore: + for client in apikeystore: + key = apikeystore[client] if md5(user + md5(key)) == token: sessionkey = self.generate_key(client) return 200,{"session":{"key":sessionkey}} diff --git a/maloja/apis/audioscrobbler_legacy.py b/maloja/apis/audioscrobbler_legacy.py index 4a01a58..322fe78 100644 --- a/maloja/apis/audioscrobbler_legacy.py +++ b/maloja/apis/audioscrobbler_legacy.py @@ -42,10 +42,9 @@ class AudioscrobblerLegacy(APIHandler): protocol = 'http' if (keys.get("u") == 'nossl') else request.urlparts.scheme if auth is not None: - for identifier in apikeystore: - key = apikeystore[identifier] - client = self.check_token(auth,key,timestamp) - if client: + for client in apikeystore: + key = apikeystore[client] + if self.check_token(auth,key,timestamp): sessionkey = self.generate_key(client) return 200, ( "OK\n"