Skip to main content

synology-api Pepy Total Downloads Website

GitHub last commit GitHub License

Synology Wrapper

If you find yourself here, most probably you are trying to develop something for your NAS, this wrapper might come to your help to build your script.

I would like to specify that I do this for hobby as is my passion and in my little free time.

Said this, there is no warranties chained and this library is provided "As Is", you will find many things can be simplified, and I slowly will but feel free to Contribute.

Premise

I've tried this wrapper only with python3. I do not know if it actually runs with previous versions

Before opening an issue make sure you do your own research, if you are not sure, write me.

Installation

The package is distributed via pip3, but it can also be installed from source.

pip3 install synology-api

or

pip3 install git+https://github.com/N4S4/synology-api

Basic Usage

Here is a basic example on how to use the package, check Getting Started - Basic Usage for more details.

from synology_api.filestation import FileStation
from synology_api.downloadstation import DownloadStation

fs = FileStation(
    'Synology Ip',
    'Synology Port',
    'Username',
    'Password',
    secure=False,
    cert_verify=False,
    dsm_version=7,
    debug=True,
    otp_code=None
)

ds = DownloadStation(
    'Synology Ip',
    'Synology Port',
    'Username',
    'Password',
    secure=False,
    cert_verify=False,
    dsm_version=7,
    debug=True,
    otp_code=None
)

fs_info = fs.get_info()
ds_info = ds.get_info()

For NAS devices reachable through QuickConnect, pass the NAS QuickConnect ID instead of an IP address and port. QuickConnect uses HTTPS automatically.

fs = FileStation(
    quickconnect_id='QuickConnect ID',
    username='Username',
    password='Password',
    cert_verify=False,
    dsm_version=7,
    debug=True,
    otp_code=None
)

Async Client (beta)

Every existing synology-api class can be made async with a single wrapper — no extra dependencies:

import asyncio
from synology_api.filestation import FileStation
from synology_api.async_client import AsyncClient

async def main():
    fs = AsyncClient(FileStation("192.168.1.x", "5001", "admin", "pass",
                                  secure=True, cert_verify=False, dsm_version=7))

    # All methods automatically awaitable
    info = await fs.get_info()
    files = await fs.get_file_list("/home")

    # Run parallel calls
    a, b, c = await asyncio.gather(
        fs.get_file_list("/home"),
        fs.get_file_list("/photo"),
        fs.get_file_list("/music"),
    )

asyncio.run(main())

Check the Async Client documentation for details.

Available Functions

At the moment there are around +300 APIs implemented with countless methods for each, the majority is not documented, but some are.

You can find a exhaustive list here: APIs - Supported APIs

Feeling kind?

If this code helps and you wish to support me:

Community

See Related projects

If you want to show your project in this section, write me.

Bugs

Maybe?

I hate bugs..

Well report them please (if you'll ever use this code)

Conclusions

There is still a lot to implement.

The code is probably in some parts twisted, I will try to optimize it at best.

Contributing

Just Don't Be Scared. Check Contribute - Contribution 101 for useful information.

Author

  • Renato Visaggio - Initial Work - N4S4

Contributors

Release files for synology-api 0.9.3

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

Source distribution (sdist)

Source distribution for synology-api 0.9.3
File Size Uploaded
synology_api-0.9.3.tar.gz 281.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for synology-api 0.9.3
File Interpreter ABI Platform
synology_api-0.9.3-py3-none-any.whl Python 3 none any Details

Total release size: 558.6 kB

Release files / synology_api-0.9.3.tar.gz

Download URL synology_api-0.9.3.tar.gz
Size 281.3 kB
Tags Source
SHA-256 checksum
How to use checksums
13bfb5a4a248d38e04b5e982f1c90aa38d11bdf06ab403c674cd788b959a37cd
BLAKE2b-256 checksum
How to use checksums
aeeb210feff2430bf8988b31b8b492bbf1deda1174da853f7c3fe9a471d2c32a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / synology_api-0.9.3-py3-none-any.whl

Download URL synology_api-0.9.3-py3-none-any.whl
Size 277.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fd4413b47055d362e31936a4042210b1d8ef420ec52678ae08aca89cf70fff4
BLAKE2b-256 checksum
How to use checksums
271f8648b42a3a02a2c65f112a48d63621aee1761c7e255567ea634fee7be2dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.9.3 This release

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

2 release files

0.1.3.2

1 release file

0.1.3

1 release file

0.1.2

2 release files

0.1.1

2 release files

0.1.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