传输rpc绑定

shifter的Python项目详细描述


______________________  _____ _____________                     1  2  3
  ________/ ___/___/ /_  __(_)___/ __/__/ /______ ________   R  │  │  │
    _____/___ \ __/ __ \ ___ ___/ /_ _/  __/_  _ \__/ ___/   └──┼──┼──┤
      ______/ / _/ / / /_/ / _/  __/  / /_  /  __/_/ /          │  │  │
        /____/  /_/ /_/ /_/   /_/     \__/  \___/ /_/           4  5  6

shifter是用于控制transmissionPython库,并使用 写入到的最新版本的传输的版本号 支持(可能适用于较新版本,但不能保证)shifter已用2.x语法编写,从python2.5开始对python2.x和python3.x都有效。

要安装:

$ pip install shifter

$ easy_install shifter

对于python3.x的版本,shifter使用2to3转换。什么时候? 使用pip或使用distribute安装,shifter将自动 转换为3.x语法。否则您可以手动运行2to3工具 使用以下命令:

$ 2to3 -f future -f reduce -f urllib -w shifter.py

shifter被设计成更轻量级和更一致的transmission rpc库比当前可用于Python的库要多。而不是简单的 使用transmission-rpc指定的键/字段 虚线分隔词和大小写混合词,shifter尝试全部转换 更加面向python的关键:下划线分隔的单词。这个转换是 这样仍然可以指定 transmission-rpc,但如果您这样做,您的里程可能会有所不同(可能希望 避免)

shifter设计用于所有版本的transmission,但是 在传输版本1.60(RPC v5)之前和之后重命名的字段 必须指定正确的参数名(无自动重命名)

使用shifter控制上的默认值transmission-daemonlocalhost

>>> client = shifter.Client()
>>> client.list()

它生成一个包含Torrent信息的字典列表(键是 字段:client.list_fields),与调用同义

>>> client.torrent.get(client.list_fields)

要使用不同的连接信息:

  • 完整路径

    >>> client = shifter.Client(address="https://host:port/path")
    
  • 默认URL,但端口更改为8080

    >>> client = shifter.Client(port=8080)
    
  • 默认URL,但主机不同

    >>> client = shifter.Client(host="github.com")
    
  • 默认URL,但使用用户名和密码

    >>> client = shifter.Client(username='username', password='password')
    

shifter的rpc方法被命名为四个部分:

Client:
  • port_test – return if transmission port is open.
  • blocklist_update – update block list and return block list size.
  • list (torrent.get helper) – list basic torrent info for all torrents
Client.queue:
  • move_bottom – move torrent to bottom of the queue
  • move_down – move torrent down in the queue
  • move_top – move torrent to the top of the queue
  • move_up – move torrent up in the queue
Client.session:
  • close – shutdown the transmission daemon
  • get – get session properties
  • set – set session properties
  • stats – get session statistics
Client.torrent:
  • add – add a new torrent
  • get – get torrent properties
  • files (torrent.get helper) – get file information for one or more torrents
  • percent_done (torrent.get helper) – get torrent percent done for one or more torrents
  • remove – remove a torrent from transmission and optionally delete the data
  • set – set torrent properties
  • set_location – set/move torrent location

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么单元测试中的“验证”在不同实例的情况下不返回“不同参数”错误?   java如何从具有相同类名的div中选择元素(Selenium)   Java制作纸牌游戏,有关于类的问题吗   bluej在Java中使用变异器和访问器设置颜色和圆半径   java准确定位异常错误的最佳方法是什么?   使用多个监视器时的java设置对话框位置   java如何在不使用JavascriptExecutor的情况下在网页中向下/向上滚动   java在for循环中将大小设置为n   java为什么akka需要不可变的消息   java LdapInvalidDnException:意外标记:   java如果字符串的第一个字母不是一个,如何大写?   使用htmlunit的java html内容提取   java从CDI托管bean获取方法的注释   java有办法在运行时检查post请求参数的大小吗   java我可以将实体注入托管Bean并直接持久化吗?