1. Erik Svensson
  2. transmissionrpc
Issue #59 open

get_torrent/s with arguments fails without 'id'

m42i
created an issue

When get_torrents() or get_torrent() is called with the arguments parameter, but 'id' is not in the list, it fails with the message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.8-intel/egg/transmissionrpc/client.py", line 577, in get_torrent
  File "build/bdist.macosx-10.8-intel/egg/transmissionrpc/client.py", line 275, in _request
  File "build/bdist.macosx-10.8-intel/egg/transmissionrpc/torrent.py", line 47, in __init__
ValueError: Torrent requires an id

E.g.

t.get_torrents(arguments = ['hashString']) - Fails

t.get_torrents(arguments = ['id', 'hashString']) - Works

Comments (3)

  1. m42i reporter

    I'm not sure we understand each other. So, I'll elaborate a bit.

    In my case, I wanted to be able to get all torrents matching a specific hashString. I ended up using this solution:

    torrents =  [ t for t in transmission.get_torrents(None, ['id', 'hashString'] ) \
                                   if t.hashString.lower() == hashString.lower() ]
    

    Though, I guess it's safe to assume, if someone retrieves torrents, they want to have the id too.

  2. Log in to comment