From ebe820a3c9439c4225ac33e3e3543f19a6ce0fca Mon Sep 17 00:00:00 2001 From: tehkillerbee Date: Thu, 5 Sep 2024 13:27:08 +0200 Subject: [PATCH] Fix formatting --- tidalapi/request.py | 18 ++++++++---------- tidalapi/session.py | 14 ++++++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tidalapi/request.py b/tidalapi/request.py index c48ac65..3cdaf60 100644 --- a/tidalapi/request.py +++ b/tidalapi/request.py @@ -154,7 +154,7 @@ def request( self.latest_err_response = request if request.content: resp = request.json() - log.debug("Request response: '%s'", resp['errors'][0]['detail']) + log.debug("Request response: '%s'", resp["errors"][0]["detail"]) if request.status_code and request.status_code == 404: raise ObjectNotFound elif request.status_code and request.status_code == 429: @@ -165,23 +165,21 @@ def request( return request def get_latest_err_response(self) -> dict: - """Get the latest request Response that resulted in an Exception - :return: The request Response that resulted in the Exception, returned as a dict - An empty dict will be returned, if no response was returned - """ + """Get the latest request Response that resulted in an Exception :return: The + request Response that resulted in the Exception, returned as a dict An empty + dict will be returned, if no response was returned.""" if self.latest_err_response.content: return self.latest_err_response.json() else: return {} def get_latest_err_response_str(self) -> str: - """Get the latest request response message as a string - :return: The contents of the (detailed) error response Response, returned as a string - An empty str will be returned, if no response was returned - """ + """Get the latest request response message as a string :return: The contents of + the (detailed) error response Response, returned as a string An empty str will + be returned, if no response was returned.""" if self.latest_err_response.content: resp = self.latest_err_response.json() - return resp['errors'][0]['detail'] + return resp["errors"][0]["detail"] else: return "" diff --git a/tidalapi/session.py b/tidalapi/session.py index 181179a..5c23c01 100644 --- a/tidalapi/session.py +++ b/tidalapi/session.py @@ -869,12 +869,13 @@ def get_tracks_by_isrc(self, isrc: str) -> list[media.Track]: An empty list will be returned if no tracks matches the ISRC """ try: + params = { + "filter[isrc]": isrc, + } res = self.request.request( "GET", "tracks", - params={ - "filter[isrc]": isrc, - }, + params=params, base_url=self.config.openapi_v2_location, ).json() if res["data"]: @@ -899,12 +900,13 @@ def get_albums_by_barcode(self, barcode: str) -> list[album.Album]: An empty list will be returned if no tracks matches the ISRC """ try: + params = { + "filter[barcodeId]": barcode, + } res = self.request.request( "GET", "albums", - params={ - "filter[barcodeId]": barcode, - }, + params=params, base_url=self.config.openapi_v2_location, ).json() if res["data"]: