Session

class transmission_rpc.session.Session[source]

Session is a dict-like class holding the session data for a Transmission daemon.

Access the session field can be done through attributes. The attributes available are the same as the session arguments in the Transmission RPC specification, but with underscore instead of hyphen.

get 'download-dir' with session.download_dir.

session = Client().get_session()

current = session.download_dir

there are also setter like Session().download_dir = '/path/to/download'

session = Client().get_session()

session.download_dir = '/path/to/new/download/dir'

if you want to batch update a session, call .update(data)

session = Client().get_session()

session.update({'k1': 'v1', "k2": "v2"})

if you have to access to the private Session()._fields, keys are stored with underscore.

__init__(client, fields=None)[source]
Parameters
  • client (Client) –

  • fields (Dict[str, Any]) –

update(other)[source]

Update the session data from a Transmission JSON-RPC arguments dictionary

Parameters

other (Union[Dict[str, Any], transmission_rpc.session.Session]) –

Return type

None

keys()[source]

session keys with underscore (eg: download_dir)

Return type

Generator[str, None, None]

items()[source]

iter key,value pair

hyphen in key is replace by underscore. (eg: 'download_dir')

Return type

Generator[Tuple[str, Any], None, None]

property download_dir: str

default download location

  • rpc version 12

  • transmission version 2.20

Returns

property version: str
  • rpc version 3

  • transmission version 1.41

property rpc_version: int
  • rpc version 4

  • transmission version 1.50

property peer_port: int

Get the peer port.

  • rpc version 5

  • transmission version 1.60

property pex_enabled: bool

Is peer exchange enabled

  • rpc version 5

  • transmission version 1.60