More exception handling for torrent removal

This commit is contained in:
Noam
2017-03-13 22:10:57 +02:00
parent bf5d07efec
commit 91ed781acb

View File

@@ -261,7 +261,11 @@ def removeTorrent(torrentid, remove_data=False):
response = requests.post(delugeweb_url, data=post_data.encode('utf-8'), cookies=delugeweb_auth,
verify=deluge_verify_cert, headers=headers)
state = json.loads(response.text)['result']['state']
try:
state = json.loads(response.text)['result']['state']
except KeyError as e:
logger.debug('Deluge: "state" KeyError when trying to remove torrent %s' % str(torrentid))
return False
not_finished = ["queued", "seeding", "downloading", "checking", "error"]
result = False