Skip to content

Commit e8b566c

Browse files
committed
Fix qbit_item_props.get("is_private", False):
AttributeError: 'Response' object has no attribute 'get'
1 parent 5a1f0eb commit e8b566c

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/settings/_download_clients_qbit.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,8 @@ async def get_protected_and_private(self):
292292
logger.debug(
293293
"_download_clients_qBit/get_protected_and_private: Checking if torrents are private (only done for old qbit versions)",
294294
)
295-
qbit_item_props = await make_request(
296-
"get",
297-
self.api_url + "/torrents/properties",
298-
self.settings,
299-
params={"hash": qbit_item["hash"]},
300-
cookies=self.cookie,
301-
)
295+
qbit_item_props = await self.get_torrent_properties(qbit_item["hash"])
296+
302297
if not qbit_item_props:
303298
logger.error(
304299
"Torrent %s not found on qBittorrent - potentially removed while checking if private. "
@@ -363,6 +358,18 @@ async def get_qbit_items(self, hashes=None):
363358
)
364359
return response.json()
365360

361+
async def get_torrent_properties(self, qbit_hash):
362+
params = {"hash": qbit_hash.lower()}
363+
response = await make_request(
364+
"get",
365+
self.api_url + "/torrents/properties",
366+
self.settings,
367+
params=params,
368+
cookies=self.cookie,
369+
)
370+
return response.json()
371+
372+
366373
async def get_torrent_files(self, download_id):
367374
# this may not work if the wrong qbit
368375
logger.debug("_download_clients_qBit/get_torrent_files: Getting torrent files")

0 commit comments

Comments
 (0)