autoremove-torrents icon indicating copy to clipboard operation
autoremove-torrents copied to clipboard

data cannot be removed. Reason: The server responses HTTP 405.

Open xiaojunanann opened this issue 1 year ago • 7 comments

您好,关于删种时xx data cannot be removed. Reason: The server responses HTTP 405. 该报错是哪边出问题呢?

xiaojunanann avatar Feb 27 '24 19:02 xiaojunanann

The issue is from this bit of code in autoremovetorrents > client > qbittorrent.py Seems something has changed with the method on qBitTorrents end, but not sure what the fix is

  # Batch Remove Torrents
    # Return values: (success_hash_list, failed_list -> {hash: reason, ...})
    def remove_torrents(self, torrent_hash_list, remove_data):
        **request = self._request_handler.delete_torrents_and_data(torrent_hash_list) if remove_data \
            else self._request_handler.delete_torrents(torrent_hash_list)**
        if request.status_code != 200:
            return ([], [{
                'hash': torrent,
                'reason': 'The server responses HTTP %d.' % request.status_code,
            } for torrent in torrent_hash_list])
        # Some of them may fail but we can't judge them,
        # So we consider all of them as successful.
        return (torrent_hash_list, [])

Jarsky avatar Mar 14 '24 20:03 Jarsky

Same problem. The server responses HTTP 405.

warioguy64 avatar Mar 23 '24 01:03 warioguy64

I can't find any documentation about it, but it seems like maybe the 'deletePerm' command has been removed from the qBittorrent API?

aormond avatar Mar 25 '24 03:03 aormond

I can't find any documentation about it, but it seems like maybe the 'deletePerm' command has been removed from the qBittorrent API?

Im in the same boat, it looks like the command is still correct per the API documentation

From the qBitTorrent Implementation:

Delete torrents Requires knowing the torrent hashes. You can get it from torrent list.

Name: delete

Parameters:

Parameter Type Description hashes string The hashes of the torrents you want to delete. hashes can contain multiple hashes separated by |, to delete multiple torrents, or set to all, to delete all torrents. deleteFiles If set to true, the downloaded data will also be deleted, otherwise has no effect. Example:

/api/v2/torrents/delete?hashes=8c212779b4abde7c6bc608063a0d008b7e40ce32&deleteFiles=false

Currently this file looks like this:

        # Batch Delete torrents
        def delete_torrents(self, torrent_hash_list):
            return self._session.get(self._host+'/api/v2/torrents/delete', params={'hashes':'|'.join(torrent_hash_list), 'deleteFiles': False})
        
        # Batch Delete torrents and data
        def delete_torrents_and_data(self, torrent_hash_list):
            return self._session.get(self._host+'/api/v2/torrents/delete', params={'hashes':'|'.join(torrent_hash_list), 'deleteFiles': True})

Something has changed on the qBitTorrent end but it doesnt seem to be documented

Jarsky avatar Apr 01 '24 06:04 Jarsky

Same here

MuhammadBayiz avatar Apr 14 '24 13:04 MuhammadBayiz

I found a working fork from ludoux here: https://github.com/ludoux/autoremove-torrents

Apparently the api calling method was wrong and he fixed it with this commit: https://github.com/jerrymakesjelly/autoremove-torrents/commit/87c073f467e54bc959750d3aa11e30bb533f0b98#diff-73fd7865a6aef90b719f0e902d8f9e7a69eb2a4d1198b84f4da0930031e692c1

MuhammadBayiz avatar Apr 14 '24 13:04 MuhammadBayiz

Yup sorry fixed mine with that same change as well. Turned out its due to qBitTorrent complying with using POST instead of GET for anything that requires a change.

Jarsky avatar Apr 15 '24 00:04 Jarsky