Skip to main content

synopy

Python library for the Synology DiskStation APIs

Description

This project aims to support as many web APIs for the Synology NAS DiskStations, as possible.

Right now the only official API specifications published by Synology(that I know of) are:

  1. the Download Station API here
  2. the File Station API here

This is alpha software and there might be dramatic changes between releases, until it reaches a stable state.

Usage

Let's see some examples.

DownloadStationInfo API

# SYNO.DownloadStation.Info namespace
from synopy.base import Connection
from synopy.api import DownloadStationInfo

# Set up a connection
conn = Connection('http', 'dsm.localdomain', port=5000)
# Authenticate and get an 'sid' cookie
conn.authenticate('admin', 'mypasswd')

# Create an instance of the DownloadStationInfo API
dsinfo_api = DownloadStationInfo(conn, version=1)
# Make a 'getinfo' query
resp = dsinfo_api.get_info()

print(resp.payload)

{
    u'data':
        {
            u'is_manager': True,
            u'version': 2480,
            u'version_string': u'3.4-2480'
        },
    u'success': True
 }

DownloadStationTask API

# SYNO.DownloadStation.Task namespace
from synopy.api import DownloadStationTask

dstask_api = DownloadStationTask(conn, version=1)
# Use the 'list' query method to see the running tasks
resp = dstask_api.list()

print(resp.payload)
{
    u'data':
        {
            u'offeset': 0, # That's not my typo ;)
            u'tasks': [{u'id': u'dbid_6',
                        u'size': u'3260371830',
                        u'status': u'paused',   # <--- it's paused :(
                        u'status_extra': None,
                        u'title': u'TOTALLY.LEGAL.TORRENT.ISO',
                        u'type': u'bt',
                        u'username': u'admin'}],
            u'total': 1
        },
    u'success': True
}

# Let's put it to work!
resp = dstask_api.resume(id='dbid_6')

print(resp.payload)
{
    u'data': [{u'error': 0, u'id': u'dbid_6'}],
    u'success': True
}

# Let's check if indeed the task resumed, but ask for additional info
resp = dstask_api.list(additional='detail,file')
print(resp.payload)
{
    u'data':
        {
            u'offeset': 0,
            u'tasks':
                [{u'additional':
                    {u'detail':
                        {u'connected_leechers': 4,
                         u'connected_seeders': 41,
                         u'create_time': u'1395142482',
                         u'destination': u'DSMFiles/Downloads',
                         u'priority': u'auto',
                         u'total_peers': 0,
                         u'uri': u'magnet:?xt=really_long_magnet_link_here'},
                         u'file': [
                            {u'filename': u'Torrent Downloaded From Legal Torrents.txt',
                             u'priority': u'normal',u'size': u'353',u'size_downloaded': u'353'},
                            {u'filename': u'legaltorrent.iso',u'priority': u'normal',
                             u'size': u'3260370944',u'size_downloaded': u'1872580608'},
                            {u'filename': u'nfo.nfo',u'priority': u'normal',u'size': u'533',
                             u'size_downloaded': u'533'}]
                        },
                     u'id': u'dbid_6',
                     u'size': u'3260371830',
                     u'status': u'downloading',  # <--- yay! :)
                     u'status_extra': None,
                     u'title': u'TOTALLY.LEGAL.TORRENT.ISO',
                     u'type': u'bt',
                     u'username': u'admin'
                    }
                ],
            u'total': 1
        },
    u'success': True
}

Notes

More to come!

Release files for synopy 0.0.0.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synopy 0.0.0.post1
File Size Uploaded
synopy-0.0.0.post1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for synopy 0.0.0.post1
File Interpreter ABI Platform
synopy-0.0.0.post1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 12.8 kB

Release files / synopy-0.0.0.post1.tar.gz

Download URL synopy-0.0.0.post1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9454f2f8b4bb77d45265240e2a132ef28384163abde7f22b2cfcd2da68796316
BLAKE2b-256 checksum
How to use checksums
5ba3e443996b81f3f66ef2afd94418abf875585ca64240a69f12515217ba5d53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

Release files / synopy-0.0.0.post1-py2.py3-none-any.whl

Download URL synopy-0.0.0.post1-py2.py3-none-any.whl
Size 7.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ee71f6e38cd8e5621d18f0811caeb343033fce8043e482a9e170f04255a647c1
BLAKE2b-256 checksum
How to use checksums
66787d8062a73982b65800d9a9a52f553233344a18409e37bfda91ffa1597884
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.0.0.post1 This release

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page