sane-bt-search: try to install some logging for a sporadic error

This commit is contained in:
Colin 2024-01-20 21:19:18 +00:00
parent a31fe44624
commit 080c8dbe3d

View File

@ -232,7 +232,12 @@ class Client:
params = params.copy()
params.update(apikey=self.apikey, _=str(int(time.time())))
resp = requests.get(url, params=params)
return resp.json()
text = str(resp.text)
try:
return json.loads(text)
except Exception as e:
logger.error(f"failed to parse json API response from {url}: {text}")
raise e
def query(self, q: str) -> list[Torrent]:
torrents = set()