Torrents

class Tribler.Core.Modules.restapi.channels.channels_torrents_endpoint.ChannelModifyTorrentEndpoint(session, cid, path)[source]

This class is responsible for methods that modify the list of torrents (adding/removing torrents).

render_DELETE(request)[source]
DELETE /channels/discovered/(string: channelid)/torrents/(string: torrent infohash)

Remove a torrent with a given infohash from a given channel.

Example request:

curl -X DELETE http://localhost:8085/channels/discovered/abcdefg/torrents/
97d2d8f5d37e56cfaeaae151d55f05b077074779

Example response:

{
    "removed": True
}
statuscode 404:if the channel is not found or if the torrent is not found in the specified channel
render_PUT(request)[source]
PUT /channels/discovered/(string: channelid)/torrents/http%3A%2F%2Ftest.com%2Ftest.torrent

Add a torrent by magnet or url to your channel. Returns error 500 if something is wrong with the torrent file and DuplicateTorrentFileError if already added to your channel (except with magnet links).

Example request:

curl -X PUT http://localhost:8085/channels/discovered/abcdefg/torrents/
http%3A%2F%2Ftest.com%2Ftest.torrent --data "description=nice video"

Example response:

{
    "added": "http://test.com/test.torrent"
}
statuscode 404:if your channel does not exist.
statuscode 500:if the specified torrent is already in your channel.
class Tribler.Core.Modules.restapi.channels.channels_torrents_endpoint.ChannelsTorrentsEndpoint(session, cid)[source]

This class is responsible for managing requests regarding torrents in a channel.

render_GET(request)[source]
GET /channels/discovered/(string: channelid)/torrents

A GET request to this endpoint returns all discovered torrents in a specific channel. The size of the torrent is in number of bytes. The last_tracker_check value will be 0 if we did not check the tracker state of the torrent yet. Optionally, we can disable the family filter for this particular request by passing the following flag: - disable_filter: whether the family filter should be disabled for this request (1 = disabled)

Example request:

curl -X GET http://localhost:8085/channels/discovered/da69aaad39ccf468aba2ab9177d5f8d8160135e6/torrents

Example response:

{
    "torrents": [{
        "id": 4,
        "infohash": "97d2d8f5d37e56cfaeaae151d55f05b077074779",
        "name": "Ubuntu-16.04-desktop-amd64",
        "size": 8592385,
        "category": "other",
        "num_seeders": 42,
        "num_leechers": 184,
        "last_tracker_check": 1463176959
    }, ...]
}
statuscode 404:if the specified channel cannot be found.
render_PUT(request)[source]
PUT /channels/discovered/(string: channelid)/torrents

Add a torrent file to your own channel. Returns error 500 if something is wrong with the torrent file and DuplicateTorrentFileError if already added to your channel. The torrent data is passed as base-64 encoded string. The description is optional.

Example request:

curl -X PUT http://localhost:8085/channels/discovered/abcd/torrents
--data "torrent=...&description=funny video"

Example response:

{
    "added": True
}
statuscode 404:if your channel does not exist.
statuscode 500:if the passed torrent data is corrupt.