Search code examples
pythonlibtorrentlibtorrent-rasterbar

Libtorrent: how can I get all torrent handles associated with a session?


If I have added multiple torrents in a session, is there any way I can get all the handles from that session ?

For eg.

h1 = ses.add_torrent(params)
h2 = ses.add_torrent(params)
h3 = ses.add_torrent(params)

is session has any method which can give me the list of all the handles associated with that session. like.

li=sess.get_all_handles()

Solution

  • there's a function on the session object called get_torrents() which returns a vector of all torrent_handles.