Code Monkey home page Code Monkey logo

synology's Introduction

Synology

Python3 binding to Synology DSM API. I refer to the following document: Synology_File_Station_API_Guide.pdf. Any help is welcome, please fork this repo and make a pull request, or contact me directly.

API coverage

Implemented

Endpoint Description
SYNO.FileStation.Info Provide File Station info
SYNO.FileStation.List List all shared folders, enumerate files in a shared folder,and get detailed file information
SYNO.FileStation.DirSize Get the total size of files/folders within folder(s)
SYNO.FileStation.MD5 Get MD5 of a file
SYNO.FileStation.CreateFolder Create folder(s)
SYNO.FileStation.Rename Rename a file/folder
SYNO.FileStation.Delete Delete files/folders
SYNO.FileStation.Search Search files on given criteria
SYNO.FileStation.Thumb Get a thumbnail of a file
SYNO.FileStation.CheckPermission Check if the file/folder has a permission of a file/folder or not
SYNO.FileStation.Upload Upload a file
SYNO.FileStation.Download Download files/folders

TODO

Endpoint Description
SYNO.FileStation.VirtualFolder List all mount point folders of virtual file system, ex: CIFS or ISO
SYNO.FileStation.Favorite Add a folder to user’s favorites or do operations on user’s favorites
SYNO.FileStation.Sharing Generate a sharing link to share files/folders with other people and perform operations on sharing links
SYNO.FileStation.CopyMove Copy/Move files/folders
SYNO.FileStation.Extract Extract an archive and do operations on an archive
SYNO.FileStation.Compress Compress files/folders
SYNO.FileStation.BackgroundTask Get information regarding tasks of file operations which are run as the background process including copy, move, delete, compress and extract tasks or perform operations on these background tasks.

Install

pip install [--upgrade] https://github.com/Eincl/synology/tarball/master#egg=synology

Usage

import config

from synology.api import Api
from synology.filestation import FileStation
from synology.utils import jsonprint

logging.basicConfig(level=logging.INFO)

# Instanciate directly
syno = Api(config.host, config.user, config.passwd)
syno.req('SYNO.API.Info', query='all')
syno.req('SYNO.FileStation.Info', end='info', extra='FileStation/',
    method='getinfo')
syno.jsonprint(syno.req(syno.endpoint('SYNO.FileStation.List',
    cgi='FileStation/file_share.cgi', method='list_share')))
syno.jsonprint(syno.req(syno.endpoint('SYNO.FileStation.Info',
    cgi='FileStation/info.cgi', method='getinfo')))

# Instanciate a FileStation
filestation = FileStation(config.host, config.user, config.passwd)
filestation.jsonprint(filestation.get_info())
filestation.jsonprint(filestation.get_shares())

synology's People

Contributors

eincl avatar mgmarino avatar satreix avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.