Skip to content

RestTorrent is BitTorrent Restful API and Socket.IO Server based Libtorrent

License

Notifications You must be signed in to change notification settings

shlee322/resttorrent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RestTorrent

RestTorrent is BitTorrent Restful API and Socket.IO Server based Libtorrent.

License

RestTorrent is released under the MIT-license.

Requirements

  • Install libtorrent

    • Ubuntu

      apt-get install python-libtorrent
      
    • ArchLinux

      yaourt -S python-libtorrent-rasterbar
      
    • Mac

      brew install libtorrent-rasterbar --with-python
      
  • Install Python Requirements

    pip install -r requirements.txt
    

Usage

  • WSGI Application

    resttorrent.wsgi:application
    
  • Run Debug Mode

    python debug.py
    
  • HTTP Restful API

    POST /v1/sessions
    

    JSONP parameter name : callback

    CORS(Access-Control-Allow-Origin) Header : *

  • Socket.IO

    socket.emit('v1', { t_id:'1', command:'create_session', ports:[6881] });

API

  • GET /v1/sessions

    • Request

      Name

      Require

      Description

      t_id

      socket.io only

      Transaction ID

      command

      socket.io only

      get_session_list

    • Response

      {
        "status": "success",
        "sessions": [
          {
            "id": "2d4c54303130302d655f38397933685052467163",
            "port": 6881
          }
        ]
      }
  • POST /v1/sessions

    • Request

      Name

      Require

      Description

      port_range

      option

      Listen Range (default: 6881,6891)

      memory_only

      option

      default:1

      t_id

      socket.io only

      Transaction ID

      command

      socket.io only

      create_session

    • Response

      {
        "status": "success",
        "session": {
          "id": "2d4c54303130302d655f38397933685052467163",
          "port": 6881
        }
      }
      {
        "status": "fail",
        "message": "bind failed address already in use"
      }
  • GET /v1/sessions/<session_id>

    • Response

      {
        "status": "success",
        "id": "2d4c54303130302d655f38397933685052467163",
        "port": 6881
      }
  • DELETE /v1/sessions/<session_id>

    • Response

      {
        "status": "success"
      }
  • POST /v1/sessions/<session_id>/torrents

    • Request

      Name

      Require

      Description

      file

      select one

      Torrent Metainfo File

      magnet

      Torrent Magnet URL

      url

      download torrent url

      save_path

      require

      Save Target Path

      autostart

      option

      autostart (default:1)

      storage_mode

      option

      default: sparse

      memory_only

      option

      default:session value

    • Response

      {
          "status": "success",
          "info_hash": "6f8cd699135b491513e65d967a052a7087750d9c",
          "download_rate": 0,
          "num_peers": 0,
          "progress": 0,
          "state": "checking_resume_data",
          "upload_rate": 0
      }
  • GET /v1/sessions/<session_id>/torrents

    • Response

      {
          "status": "success",
          "torrents": [
              {
                  "info_hash": "6f8cd699135b491513e65d967a052a7087750d9c",
                  "download_rate": 0,
                  "num_peers": 5,
                  "progress": 0.0037299999967217445,
                  "state": "downloading",
                  "upload_rate": 116
              }
          ]
      }

About

RestTorrent is BitTorrent Restful API and Socket.IO Server based Libtorrent

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages