![]() delete_path ( '/mydrive/abc_folder' ) synd. write ( bio ) Delete file or folderĭelete file or folder is an async task. download_synology_office_file ( '/mydrive/test.odoc' ) with open ( 'test.docx', 'wb' ) as f : f. read_excel ( bio, sheet_name = None ) # dowloand odoc as docx bio = synd. download_file ( '/mydrive/test.osheet' ) pd. download_synology_office_file ( '/mydrive/test.osheet' ) # or bio = synd. write ( bio ) Download Synology office file import pandas as pd # download osheet as xlsx and read into pandas dataframe. [ ' ) with open ( file_name, 'wb' ) as f : f. '/team-folders/test_drive/SCU285/test.xls', '/mydrive/test_sheet_file.osheet' 2. manage_path_label ( action, path, label ) delete_label ( label_id = 419 ) Add/delete path label # acition:add, delete synd. delete_label ( 'your_label_name' ) ret = synd. create_label ( 'your_label_name', color = 'orange', pos = 0 ) # delete label by name/id. # default color is gray, default position is end of labels. # create a label, color name: gray/red/orange/yellow/green/blue/purple. get_labels ( 'your_label_name' ) # get all labels info synd. Get label info # get single label info synd. If you need label intersection search, combine them into one label. Synology drive search function provide label union search rather than intersection search. Another solution is creating a tool user. If you want share labels between users, you should have access to these user accounts. Synology drive thinks labels need to belong to single user. download_file ( '/mydrive/test.osheet' ) # write your code here Manage labels with SynologyDrive ( NAS_USER, NAS_PASS, NAS_IP, dsm_version = '7' ) as synd : synd. from synology_drive_api.drive import SynologyDrive # default http port is 5000, https is 5001. If you use dsm 7, default dsm_version is '6'. list_folder ( '/mydrive' ) # write your code here upload_file ( file, dest_folder_path = dest_folder_path ) # write your code here # disable label cache with SynologyDrive ( NAS_USER, NAS_PASS, drive_path_demo, enable_label_cache = False ) as synd : synd. list_folder ( '/mydrive' ) # write your code here # use domain name or name + path access drive # Enabled in Application Portal | Application | Drive | General | Enable customized alias drive_path_demo = 'your_nas_domain/drive' # Enabled in Application Portal | Application | Drive | General | Enable customized domain drive_path_demo2 = 'your_drive_domain' with SynologyDrive ( NAS_USER, NAS_PASS, drive_path_demo ) as synd : synd. with SynologyDrive ( NAS_USER, NAS_PASS, otp_code = 'XXXXXX' ) as synd : synd. create_folder ( 'test', 'team-folder/folder2/' ) # write your code here # Enable 2fa. with SynologyDrive ( NAS_USER, NAS_PASS, NAS_IP, https = False ) as synd : synd. get_file_or_folder_info ( path_or_path_id ) # write your code here # use http instead of https. list_folder ( '/mydrive' ) # write your code here # Use specified port with SynologyDrive ( NAS_USER, NAS_PASS, NAS_IP, NAS_PORT ) as synd : synd. with SynologyDrive ( NAS_USER, NAS_PASS, NAS_IP ) as synd : synd. if you need multiple login session and label functions, disable label cache. Synology Drive allows same user with multiple login session. You can access drive by IP, drive domain or nas domain + drive path. Installation pip install synology-drive-api ![]() ![]() By means of Synology Office, you can edit spreadsheet on Drive and use this api wrapper read spreadsheet. ![]() It helps you manage your files/folders/labels in synology drive. ![]() This repo is aimed at providing Synology drive api wrapper and related helper functions. Synology-drive-api is inspired by synology-api. ![]()
0 Comments
Leave a Reply. |