synology-api 0.6.2__tar.gz → 0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {synology-api-0.6.2 → synology-api-0.7}/PKG-INFO +102 -9
- synology-api-0.6.2/synology_api.egg-info/PKG-INFO → synology-api-0.7/README.md +98 -19
- {synology-api-0.6.2 → synology-api-0.7}/setup.py +21 -21
- synology-api-0.7/synology_api/__init__.py +25 -0
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/audiostation.py +13 -40
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/auth.py +64 -6
- synology-api-0.6.2/synology_api/base_api_core.py → synology-api-0.7/synology_api/base_api.py +2 -1
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/core_active_backup.py +24 -16
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/core_backup.py +4 -19
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/core_certificate.py +5 -6
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/core_sys_info.py +4 -17
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/dhcp_server.py +25 -21
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/directory_server.py +2 -16
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/docker_api.py +2 -16
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/downloadstation.py +24 -26
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/drive_admin_console.py +4 -18
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/filestation.py +13 -15
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/log_center.py +4 -18
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/notestation.py +4 -18
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/oauth.py +4 -18
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/photos.py +5 -10
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/security_advisor.py +2 -16
- synology-api-0.7/synology_api/snapshot.py +261 -0
- synology-api-0.7/synology_api/surveillancestation.py +5236 -0
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/universal_search.py +3 -27
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/usb_copy.py +4 -18
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/virtualization.py +4 -15
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/vpn.py +4 -18
- synology-api-0.6.2/README.md → synology-api-0.7/synology_api.egg-info/PKG-INFO +112 -8
- {synology-api-0.6.2 → synology-api-0.7}/synology_api.egg-info/SOURCES.txt +3 -1
- synology-api-0.6.2/synology_api/__init__.py +0 -23
- {synology-api-0.6.2 → synology-api-0.7}/LICENSE.txt +0 -0
- {synology-api-0.6.2 → synology-api-0.7}/setup.cfg +0 -0
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/error_codes.py +0 -0
- {synology-api-0.6.2 → synology-api-0.7}/synology_api/exceptions.py +0 -0
- {synology-api-0.6.2 → synology-api-0.7}/synology_api.egg-info/dependency_links.txt +0 -0
- {synology-api-0.6.2 → synology-api-0.7}/synology_api.egg-info/requires.txt +0 -0
- {synology-api-0.6.2 → synology-api-0.7}/synology_api.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: synology-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7
|
|
4
4
|
Summary: Python Synology API Wrapper
|
|
5
5
|
Home-page: https://github.com/N4S4/synology-api
|
|
6
6
|
Author: Renato Visaggio
|
|
@@ -8,6 +8,9 @@ Author-email: synology.python.api@gmail.com
|
|
|
8
8
|
License: MIT
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE.txt
|
|
11
|
+
Requires-Dist: requests
|
|
12
|
+
Requires-Dist: urllib3
|
|
13
|
+
Requires-Dist: setuptools
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|

|
|
@@ -19,10 +22,10 @@ most probably you are trying to develop something for your NAS,
|
|
|
19
22
|
|
|
20
23
|
this wrapper might come to your help to build your script.
|
|
21
24
|
|
|
22
|
-
I would like to specify that
|
|
23
|
-
for hobby as is my passion and in my **little** free time.
|
|
25
|
+
I would like to specify that I do this for hobby as is my passion and in my **little** free time.
|
|
24
26
|
|
|
25
|
-
Said this
|
|
27
|
+
Said this, there is no warranties chained and this library is provided **"As Is"**,
|
|
28
|
+
you will find many things can be simplified, and I slowly will but feel free to [Contribute](https://github.com/N4S4/synology-api/blob/master/CONTRIBUTING.md).
|
|
26
29
|
|
|
27
30
|
## Feeling kind?
|
|
28
31
|
If this code helps and you wish to support me
|
|
@@ -138,11 +141,16 @@ I will slowly implement more functions, Synology APIs are plenty, too many for m
|
|
|
138
141
|
|
|
139
142
|
This wrapper cover the following APIs for now:
|
|
140
143
|
|
|
141
|
-
| DownloadStation
|
|
142
|
-
|
|
143
|
-
| SYNO.DownloadStation.Info
|
|
144
|
-
| SYNO.DownloadStation.Schedule
|
|
145
|
-
| SYNO.DownloadStation.Task
|
|
144
|
+
| DownloadStation |
|
|
145
|
+
|--------------------------------|
|
|
146
|
+
| SYNO.DownloadStation.Info |
|
|
147
|
+
| SYNO.DownloadStation.Schedule |
|
|
148
|
+
| SYNO.DownloadStation.Task |
|
|
149
|
+
| SYNO.DownloadStation.Statistic |
|
|
150
|
+
| SYNO.DownloadStation.RSS.Site |
|
|
151
|
+
| SYNO.DownloadStation.RSS.Feed |
|
|
152
|
+
| SYNO.DownloadStation.BTSearch |
|
|
153
|
+
|
|
146
154
|
|
|
147
155
|
| FileStation |
|
|
148
156
|
|----------------------------------|
|
|
@@ -256,6 +264,76 @@ This wrapper cover the following APIs for now:
|
|
|
256
264
|
|-------------------------------------------------|
|
|
257
265
|
| SYNO.ActiveBackup.Inventory |
|
|
258
266
|
| SYNO.ActiveBackup.Overview |
|
|
267
|
+
| SYNO.ActiveBackup.Task |
|
|
268
|
+
| SYNO.ActiveBackup.Share |
|
|
269
|
+
|
|
270
|
+
| Snapshot Replication |
|
|
271
|
+
| -------------------------|
|
|
272
|
+
| SYNO.Core.Share.Snapshot |
|
|
273
|
+
|
|
274
|
+
#
|
|
275
|
+
### Not all Surveillance Station functions works.
|
|
276
|
+
|
|
277
|
+
| Surveillance Station |
|
|
278
|
+
|--------------------------|
|
|
279
|
+
| SYNO.SurveillanceStation.Info |
|
|
280
|
+
| SYNO.SurveillanceStation.Camera |
|
|
281
|
+
| SYNO.Surveillance.Camera.Event |
|
|
282
|
+
| SYNO.SurveillanceStation.Camera.Group |
|
|
283
|
+
| SYNO.SurveillanceStation.Camera.Import |
|
|
284
|
+
| SYNO.SurveillanceStation.Camera.Wizard |
|
|
285
|
+
| SYNO.SurveillanceStation.PTZ |
|
|
286
|
+
| SYNO.SurveillanceStation.ExternalRecording. |
|
|
287
|
+
| SYNO.SurveillanceStation.Recording |
|
|
288
|
+
| SYNO.SurveillanceStation.Recording.Export |
|
|
289
|
+
| SYNO.SurveillanceStation.Recording.Mount |
|
|
290
|
+
| SYNO.SurveillanceStation.CMS |
|
|
291
|
+
| SYNO.SurveillanceStation.CMS.GetDsStatus |
|
|
292
|
+
| SYNO.SurveillanceStation.CMS.SlavedsWizard |
|
|
293
|
+
| SYNO.SurveillanceStation.CMS.SlavedsList |
|
|
294
|
+
| SYNO.SurveillanceStation.Log |
|
|
295
|
+
| SYNO.SurveillanceStation.License |
|
|
296
|
+
| SYNO.SurveillanceStation.Stream |
|
|
297
|
+
| SYNO.SurveillanceStation.ActionRule |
|
|
298
|
+
| SYNO.SurveillanceStation.Emap |
|
|
299
|
+
| SYNO.SurveillanceStation.Emap.Image |
|
|
300
|
+
| SYNO.SurveillanceStation.Notification |
|
|
301
|
+
| SYNO.SurveillanceStation.Notification.SMS |
|
|
302
|
+
| SYNO.SurveillanceStation.Notification.PushService |
|
|
303
|
+
| SYNO.SurveillanceStation.Notification.Schedule |
|
|
304
|
+
| SYNO.SurveillanceStation.Notification.Email |
|
|
305
|
+
| SYNO.SurveillanceStation.Notification.Filter |
|
|
306
|
+
| SYNO.SurveillanceStation.Notification.SMS.ServiceProvider |
|
|
307
|
+
| SYNO.SurveillanceStation.Addons |
|
|
308
|
+
| SYNO.SurveillanceStation.Alert |
|
|
309
|
+
| SYNO.SurveillanceStation.Alert.Setting |
|
|
310
|
+
| SYNO.SurveillanceStation.SnapShot |
|
|
311
|
+
| SYNO.SurveillanceStation.VisualStation |
|
|
312
|
+
| SYNO.SurveillanceStation.VisualStation.Layout |
|
|
313
|
+
| SYNO.SurveillanceStation.VisualStation.Search |
|
|
314
|
+
| SYNO.SurveillanceStation.AxisAcsCtrler |
|
|
315
|
+
| SYNO.SurveillanceStation.AxisAcsCtrler.Search |
|
|
316
|
+
| SYNO.SurveillanceStation.DigitalOutput |
|
|
317
|
+
| SYNO.SurveillanceStation.ExternalEvent |
|
|
318
|
+
| SYNO.SurveillanceStation.IOModule |
|
|
319
|
+
| SYNO.SurveillanceStation.IOModuleSearch |
|
|
320
|
+
| SYNO.SurveillanceStation.Camera.Status |
|
|
321
|
+
| SYNO.SurveillanceStation.PTZ.Preset |
|
|
322
|
+
| SYNO.SurveillanceStation.PTZ.Patrol. |
|
|
323
|
+
| SYNO.SurveillanceStation.Camera.Search |
|
|
324
|
+
| SYNO.SurveillanceStation.HomeMode |
|
|
325
|
+
| SYNO.SurveillanceStation.Transactions.Device |
|
|
326
|
+
| SYNO.SurveillanceStation.Transactions.Transaction |
|
|
327
|
+
| SYNO.SurveillanceStation.Archiving.Pull |
|
|
328
|
+
| SYNO.SurveillanceStation.YoutubeLive |
|
|
329
|
+
| SYNO.SurveillanceStation.IVA |
|
|
330
|
+
| SYNO.SurveillanceStation.IVA.Report |
|
|
331
|
+
| SYNO.SurveillanceStation.IVA.Recording |
|
|
332
|
+
| SYNO.SurveillanceStation.IVA.TaskGroup |
|
|
333
|
+
| SYNO.SurveillanceStation.Face |
|
|
334
|
+
| SYNO.SurveillanceStation.Face.Result |
|
|
335
|
+
| SYNO.SurveillanceStation.Recording.Bookmark |
|
|
336
|
+
|
|
259
337
|
|
|
260
338
|
#### FileStation Functions list
|
|
261
339
|
|
|
@@ -319,6 +397,10 @@ To run the following functions you'll have to start the task with the start func
|
|
|
319
397
|
|
|
320
398
|
#### DownloadStations functions:
|
|
321
399
|
|
|
400
|
+
For some of DownloadStation API there is the possibility to set version 2, ex. SYNO.DownloadStation.BTSearch,
|
|
401
|
+
if you encounter problems you might set ```download_st_version = 2``` during initialization.
|
|
402
|
+
|
|
403
|
+
|
|
322
404
|
| Function | Description |
|
|
323
405
|
|-----------------------|------------------------------------------|
|
|
324
406
|
| get_info() | Download Station info |
|
|
@@ -518,6 +600,7 @@ DS info with below functions:
|
|
|
518
600
|
|-----------------------------|------------------------------------|
|
|
519
601
|
| list_vm_hypervisor() | list of all configured hypervisors |
|
|
520
602
|
| list_device_transfer_size() | list of all detected vms |
|
|
603
|
+
| list_storage() | list of all storages |
|
|
521
604
|
|
|
522
605
|
### core_certificate tnx to @ajarzyn
|
|
523
606
|
|
|
@@ -568,6 +651,8 @@ DS info with below functions:
|
|
|
568
651
|
| tftp() |
|
|
569
652
|
| network_bond() |
|
|
570
653
|
| network_ethernet() |
|
|
654
|
+
| dhcp_clientlist() |
|
|
655
|
+
| dhcp_reservations() |
|
|
571
656
|
|
|
572
657
|
|
|
573
658
|
### usb_copy
|
|
@@ -590,6 +675,14 @@ DS info with below functions:
|
|
|
590
675
|
| registry_send_list() |
|
|
591
676
|
| history() |
|
|
592
677
|
|
|
678
|
+
### snapshot (Snapshot Replication)
|
|
679
|
+
| Functions |
|
|
680
|
+
|---------------------|
|
|
681
|
+
| list_snapshots() |
|
|
682
|
+
| create_snapshot() |
|
|
683
|
+
| delete_snapshots() |
|
|
684
|
+
| set_snapshot_attr() |
|
|
685
|
+
|
|
593
686
|
|
|
594
687
|
#### What's still missing
|
|
595
688
|
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: synology-api
|
|
3
|
-
Version: 0.6.2
|
|
4
|
-
Summary: Python Synology API Wrapper
|
|
5
|
-
Home-page: https://github.com/N4S4/synology-api
|
|
6
|
-
Author: Renato Visaggio
|
|
7
|
-
Author-email: synology.python.api@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
License-File: LICENSE.txt
|
|
11
|
-
|
|
12
1
|
|
|
13
2
|

|
|
14
3
|
|
|
@@ -19,10 +8,10 @@ most probably you are trying to develop something for your NAS,
|
|
|
19
8
|
|
|
20
9
|
this wrapper might come to your help to build your script.
|
|
21
10
|
|
|
22
|
-
I would like to specify that
|
|
23
|
-
for hobby as is my passion and in my **little** free time.
|
|
11
|
+
I would like to specify that I do this for hobby as is my passion and in my **little** free time.
|
|
24
12
|
|
|
25
|
-
Said this
|
|
13
|
+
Said this, there is no warranties chained and this library is provided **"As Is"**,
|
|
14
|
+
you will find many things can be simplified, and I slowly will but feel free to [Contribute](https://github.com/N4S4/synology-api/blob/master/CONTRIBUTING.md).
|
|
26
15
|
|
|
27
16
|
## Feeling kind?
|
|
28
17
|
If this code helps and you wish to support me
|
|
@@ -138,11 +127,16 @@ I will slowly implement more functions, Synology APIs are plenty, too many for m
|
|
|
138
127
|
|
|
139
128
|
This wrapper cover the following APIs for now:
|
|
140
129
|
|
|
141
|
-
| DownloadStation
|
|
142
|
-
|
|
143
|
-
| SYNO.DownloadStation.Info
|
|
144
|
-
| SYNO.DownloadStation.Schedule
|
|
145
|
-
| SYNO.DownloadStation.Task
|
|
130
|
+
| DownloadStation |
|
|
131
|
+
|--------------------------------|
|
|
132
|
+
| SYNO.DownloadStation.Info |
|
|
133
|
+
| SYNO.DownloadStation.Schedule |
|
|
134
|
+
| SYNO.DownloadStation.Task |
|
|
135
|
+
| SYNO.DownloadStation.Statistic |
|
|
136
|
+
| SYNO.DownloadStation.RSS.Site |
|
|
137
|
+
| SYNO.DownloadStation.RSS.Feed |
|
|
138
|
+
| SYNO.DownloadStation.BTSearch |
|
|
139
|
+
|
|
146
140
|
|
|
147
141
|
| FileStation |
|
|
148
142
|
|----------------------------------|
|
|
@@ -256,6 +250,76 @@ This wrapper cover the following APIs for now:
|
|
|
256
250
|
|-------------------------------------------------|
|
|
257
251
|
| SYNO.ActiveBackup.Inventory |
|
|
258
252
|
| SYNO.ActiveBackup.Overview |
|
|
253
|
+
| SYNO.ActiveBackup.Task |
|
|
254
|
+
| SYNO.ActiveBackup.Share |
|
|
255
|
+
|
|
256
|
+
| Snapshot Replication |
|
|
257
|
+
| -------------------------|
|
|
258
|
+
| SYNO.Core.Share.Snapshot |
|
|
259
|
+
|
|
260
|
+
#
|
|
261
|
+
### Not all Surveillance Station functions works.
|
|
262
|
+
|
|
263
|
+
| Surveillance Station |
|
|
264
|
+
|--------------------------|
|
|
265
|
+
| SYNO.SurveillanceStation.Info |
|
|
266
|
+
| SYNO.SurveillanceStation.Camera |
|
|
267
|
+
| SYNO.Surveillance.Camera.Event |
|
|
268
|
+
| SYNO.SurveillanceStation.Camera.Group |
|
|
269
|
+
| SYNO.SurveillanceStation.Camera.Import |
|
|
270
|
+
| SYNO.SurveillanceStation.Camera.Wizard |
|
|
271
|
+
| SYNO.SurveillanceStation.PTZ |
|
|
272
|
+
| SYNO.SurveillanceStation.ExternalRecording. |
|
|
273
|
+
| SYNO.SurveillanceStation.Recording |
|
|
274
|
+
| SYNO.SurveillanceStation.Recording.Export |
|
|
275
|
+
| SYNO.SurveillanceStation.Recording.Mount |
|
|
276
|
+
| SYNO.SurveillanceStation.CMS |
|
|
277
|
+
| SYNO.SurveillanceStation.CMS.GetDsStatus |
|
|
278
|
+
| SYNO.SurveillanceStation.CMS.SlavedsWizard |
|
|
279
|
+
| SYNO.SurveillanceStation.CMS.SlavedsList |
|
|
280
|
+
| SYNO.SurveillanceStation.Log |
|
|
281
|
+
| SYNO.SurveillanceStation.License |
|
|
282
|
+
| SYNO.SurveillanceStation.Stream |
|
|
283
|
+
| SYNO.SurveillanceStation.ActionRule |
|
|
284
|
+
| SYNO.SurveillanceStation.Emap |
|
|
285
|
+
| SYNO.SurveillanceStation.Emap.Image |
|
|
286
|
+
| SYNO.SurveillanceStation.Notification |
|
|
287
|
+
| SYNO.SurveillanceStation.Notification.SMS |
|
|
288
|
+
| SYNO.SurveillanceStation.Notification.PushService |
|
|
289
|
+
| SYNO.SurveillanceStation.Notification.Schedule |
|
|
290
|
+
| SYNO.SurveillanceStation.Notification.Email |
|
|
291
|
+
| SYNO.SurveillanceStation.Notification.Filter |
|
|
292
|
+
| SYNO.SurveillanceStation.Notification.SMS.ServiceProvider |
|
|
293
|
+
| SYNO.SurveillanceStation.Addons |
|
|
294
|
+
| SYNO.SurveillanceStation.Alert |
|
|
295
|
+
| SYNO.SurveillanceStation.Alert.Setting |
|
|
296
|
+
| SYNO.SurveillanceStation.SnapShot |
|
|
297
|
+
| SYNO.SurveillanceStation.VisualStation |
|
|
298
|
+
| SYNO.SurveillanceStation.VisualStation.Layout |
|
|
299
|
+
| SYNO.SurveillanceStation.VisualStation.Search |
|
|
300
|
+
| SYNO.SurveillanceStation.AxisAcsCtrler |
|
|
301
|
+
| SYNO.SurveillanceStation.AxisAcsCtrler.Search |
|
|
302
|
+
| SYNO.SurveillanceStation.DigitalOutput |
|
|
303
|
+
| SYNO.SurveillanceStation.ExternalEvent |
|
|
304
|
+
| SYNO.SurveillanceStation.IOModule |
|
|
305
|
+
| SYNO.SurveillanceStation.IOModuleSearch |
|
|
306
|
+
| SYNO.SurveillanceStation.Camera.Status |
|
|
307
|
+
| SYNO.SurveillanceStation.PTZ.Preset |
|
|
308
|
+
| SYNO.SurveillanceStation.PTZ.Patrol. |
|
|
309
|
+
| SYNO.SurveillanceStation.Camera.Search |
|
|
310
|
+
| SYNO.SurveillanceStation.HomeMode |
|
|
311
|
+
| SYNO.SurveillanceStation.Transactions.Device |
|
|
312
|
+
| SYNO.SurveillanceStation.Transactions.Transaction |
|
|
313
|
+
| SYNO.SurveillanceStation.Archiving.Pull |
|
|
314
|
+
| SYNO.SurveillanceStation.YoutubeLive |
|
|
315
|
+
| SYNO.SurveillanceStation.IVA |
|
|
316
|
+
| SYNO.SurveillanceStation.IVA.Report |
|
|
317
|
+
| SYNO.SurveillanceStation.IVA.Recording |
|
|
318
|
+
| SYNO.SurveillanceStation.IVA.TaskGroup |
|
|
319
|
+
| SYNO.SurveillanceStation.Face |
|
|
320
|
+
| SYNO.SurveillanceStation.Face.Result |
|
|
321
|
+
| SYNO.SurveillanceStation.Recording.Bookmark |
|
|
322
|
+
|
|
259
323
|
|
|
260
324
|
#### FileStation Functions list
|
|
261
325
|
|
|
@@ -319,6 +383,10 @@ To run the following functions you'll have to start the task with the start func
|
|
|
319
383
|
|
|
320
384
|
#### DownloadStations functions:
|
|
321
385
|
|
|
386
|
+
For some of DownloadStation API there is the possibility to set version 2, ex. SYNO.DownloadStation.BTSearch,
|
|
387
|
+
if you encounter problems you might set ```download_st_version = 2``` during initialization.
|
|
388
|
+
|
|
389
|
+
|
|
322
390
|
| Function | Description |
|
|
323
391
|
|-----------------------|------------------------------------------|
|
|
324
392
|
| get_info() | Download Station info |
|
|
@@ -518,6 +586,7 @@ DS info with below functions:
|
|
|
518
586
|
|-----------------------------|------------------------------------|
|
|
519
587
|
| list_vm_hypervisor() | list of all configured hypervisors |
|
|
520
588
|
| list_device_transfer_size() | list of all detected vms |
|
|
589
|
+
| list_storage() | list of all storages |
|
|
521
590
|
|
|
522
591
|
### core_certificate tnx to @ajarzyn
|
|
523
592
|
|
|
@@ -568,6 +637,8 @@ DS info with below functions:
|
|
|
568
637
|
| tftp() |
|
|
569
638
|
| network_bond() |
|
|
570
639
|
| network_ethernet() |
|
|
640
|
+
| dhcp_clientlist() |
|
|
641
|
+
| dhcp_reservations() |
|
|
571
642
|
|
|
572
643
|
|
|
573
644
|
### usb_copy
|
|
@@ -590,6 +661,14 @@ DS info with below functions:
|
|
|
590
661
|
| registry_send_list() |
|
|
591
662
|
| history() |
|
|
592
663
|
|
|
664
|
+
### snapshot (Snapshot Replication)
|
|
665
|
+
| Functions |
|
|
666
|
+
|---------------------|
|
|
667
|
+
| list_snapshots() |
|
|
668
|
+
| create_snapshot() |
|
|
669
|
+
| delete_snapshots() |
|
|
670
|
+
| set_snapshot_attr() |
|
|
671
|
+
|
|
593
672
|
|
|
594
673
|
#### What's still missing
|
|
595
674
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
from setuptools import setup, find_packages
|
|
2
|
-
|
|
3
|
-
# read the contents of your README file
|
|
4
|
-
from os import path
|
|
5
|
-
this_directory = path.abspath(path.dirname(__file__))
|
|
6
|
-
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
|
|
7
|
-
long_description = f.read()
|
|
8
|
-
|
|
9
|
-
setup(
|
|
10
|
-
name='synology-api',
|
|
11
|
-
version='0.
|
|
12
|
-
packages=find_packages(exclude=['tests*']),
|
|
13
|
-
license='MIT',
|
|
14
|
-
description='Python Synology API Wrapper',
|
|
15
|
-
long_description=long_description,
|
|
16
|
-
long_description_content_type='text/markdown',
|
|
17
|
-
install_requires=['requests', 'urllib3', 'setuptools'],
|
|
18
|
-
url='https://github.com/N4S4/synology-api',
|
|
19
|
-
author='Renato Visaggio',
|
|
20
|
-
author_email='synology.python.api@gmail.com'
|
|
21
|
-
)
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
# read the contents of your README file
|
|
4
|
+
from os import path
|
|
5
|
+
this_directory = path.abspath(path.dirname(__file__))
|
|
6
|
+
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
|
|
7
|
+
long_description = f.read()
|
|
8
|
+
|
|
9
|
+
setup(
|
|
10
|
+
name='synology-api',
|
|
11
|
+
version='0.7',
|
|
12
|
+
packages=find_packages(exclude=['tests*']),
|
|
13
|
+
license='MIT',
|
|
14
|
+
description='Python Synology API Wrapper',
|
|
15
|
+
long_description=long_description,
|
|
16
|
+
long_description_content_type='text/markdown',
|
|
17
|
+
install_requires=['requests', 'urllib3', 'setuptools'],
|
|
18
|
+
url='https://github.com/N4S4/synology-api',
|
|
19
|
+
author='Renato Visaggio',
|
|
20
|
+
author_email='synology.python.api@gmail.com'
|
|
21
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from . import \
|
|
2
|
+
audiostation, \
|
|
3
|
+
auth, \
|
|
4
|
+
base_api, \
|
|
5
|
+
directory_server, \
|
|
6
|
+
docker_api, \
|
|
7
|
+
drive_admin_console, \
|
|
8
|
+
core_active_backup, \
|
|
9
|
+
core_backup, \
|
|
10
|
+
core_certificate, \
|
|
11
|
+
core_sys_info, \
|
|
12
|
+
downloadstation, \
|
|
13
|
+
log_center, \
|
|
14
|
+
vpn, \
|
|
15
|
+
oauth, \
|
|
16
|
+
security_advisor, \
|
|
17
|
+
dhcp_server, \
|
|
18
|
+
notestation, \
|
|
19
|
+
filestation, \
|
|
20
|
+
photos, \
|
|
21
|
+
usb_copy, \
|
|
22
|
+
virtualization, \
|
|
23
|
+
universal_search, \
|
|
24
|
+
snapshot, \
|
|
25
|
+
surveillancestation
|
|
@@ -1,47 +1,20 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from typing import Optional
|
|
3
|
-
from . import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class AudioStation:
|
|
7
|
-
|
|
8
|
-
def __init__(self,
|
|
9
|
-
ip_address: str,
|
|
10
|
-
port: str,
|
|
11
|
-
username: str,
|
|
12
|
-
password: str,
|
|
13
|
-
secure: bool = False,
|
|
14
|
-
cert_verify: bool = False,
|
|
15
|
-
dsm_version: int = 7,
|
|
16
|
-
debug: bool = True,
|
|
17
|
-
otp_code: Optional[str] = None
|
|
18
|
-
) -> None:
|
|
19
|
-
self.session = syn.Authentication(ip_address, port, username, password, secure, cert_verify, dsm_version, debug,
|
|
20
|
-
otp_code)
|
|
21
|
-
|
|
22
|
-
self.session.login('AudioStation')
|
|
23
|
-
self.session.get_api_list('AudioStation')
|
|
24
|
-
|
|
25
|
-
self.request_data = self.session.request_data
|
|
26
|
-
self.audiostation_list = self.session.app_api_list
|
|
27
|
-
self._sid = self.session.sid
|
|
28
|
-
self.base_url = self.session.base_url
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
def logout(self) -> None:
|
|
32
|
-
self.session.logout('AudioStation')
|
|
33
|
-
return
|
|
3
|
+
from . import base_api
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AudioStation(base_api.BaseApi):
|
|
34
7
|
|
|
35
8
|
def get_info(self) -> dict[str, object] | str:
|
|
36
9
|
api_name = 'SYNO.AudioStation.Info'
|
|
37
|
-
info = self.
|
|
10
|
+
info = self.gen_list[api_name]
|
|
38
11
|
api_path = info['path']
|
|
39
12
|
req_param = {'version': info['maxVersion'], 'method': 'getinfo'}
|
|
40
13
|
return self.request_data(api_name, api_path, req_param)
|
|
41
14
|
|
|
42
15
|
def get_playlist_info(self) -> dict[str, object] | str:
|
|
43
16
|
api_name = 'SYNO.AudioStation.Playlist'
|
|
44
|
-
info = self.
|
|
17
|
+
info = self.gen_list[api_name]
|
|
45
18
|
api_path = info['path']
|
|
46
19
|
req_param = {'method': 'list', 'library': 'all', 'limit': '100000', 'version': info['maxVersion']}
|
|
47
20
|
|
|
@@ -49,7 +22,7 @@ class AudioStation:
|
|
|
49
22
|
|
|
50
23
|
def list_remote_player(self) -> dict[str, object] | str:
|
|
51
24
|
api_name = 'SYNO.AudioStation.RemotePlayer'
|
|
52
|
-
info = self.
|
|
25
|
+
info = self.gen_list[api_name]
|
|
53
26
|
api_path = info['path']
|
|
54
27
|
req_param = {'method': 'list', 'type': 'all', 'additional': 'subplayer_list', 'version': info['maxVersion']}
|
|
55
28
|
|
|
@@ -57,7 +30,7 @@ class AudioStation:
|
|
|
57
30
|
|
|
58
31
|
def list_pinned_song(self) -> dict[str, object] | str:
|
|
59
32
|
api_name = 'SYNO.AudioStation.Pin'
|
|
60
|
-
info = self.
|
|
33
|
+
info = self.gen_list[api_name]
|
|
61
34
|
api_path = info['path']
|
|
62
35
|
req_param = {'method': 'list', 'version': info['maxVersion']}
|
|
63
36
|
|
|
@@ -65,7 +38,7 @@ class AudioStation:
|
|
|
65
38
|
|
|
66
39
|
def device_id(self, device: str) -> dict[str, object] | str:
|
|
67
40
|
api_name = 'SYNO.AudioStation.RemotePlayer'
|
|
68
|
-
info = self.
|
|
41
|
+
info = self.gen_list[api_name]
|
|
69
42
|
api_path = info['path']
|
|
70
43
|
req_param = {'method': 'getplaylist', 'id': device, 'version': info['maxVersion']}
|
|
71
44
|
|
|
@@ -75,7 +48,7 @@ class AudioStation:
|
|
|
75
48
|
|
|
76
49
|
def remote_play(self, device: str) -> dict[str, object] | str:
|
|
77
50
|
api_name = 'SYNO.AudioStation.RemotePlayer'
|
|
78
|
-
info = self.
|
|
51
|
+
info = self.gen_list[api_name]
|
|
79
52
|
api_path = info['path']
|
|
80
53
|
req_param = {'method': 'control', 'id': device, 'version': info['maxVersion'], 'action': 'play'}
|
|
81
54
|
|
|
@@ -83,7 +56,7 @@ class AudioStation:
|
|
|
83
56
|
|
|
84
57
|
def remote_stop(self, device: str) -> dict[str, object] | str:
|
|
85
58
|
api_name = 'SYNO.AudioStation.RemotePlayer'
|
|
86
|
-
info = self.
|
|
59
|
+
info = self.gen_list[api_name]
|
|
87
60
|
api_path = info['path']
|
|
88
61
|
req_param = {'method': 'control', 'id': device, 'version': info['maxVersion'], 'action': 'stop'}
|
|
89
62
|
|
|
@@ -91,7 +64,7 @@ class AudioStation:
|
|
|
91
64
|
|
|
92
65
|
def remote_next(self, device: str) -> dict[str, object] | str:
|
|
93
66
|
api_name = 'SYNO.AudioStation.RemotePlayer'
|
|
94
|
-
info = self.
|
|
67
|
+
info = self.gen_list[api_name]
|
|
95
68
|
api_path = info['path']
|
|
96
69
|
req_param = {'method': 'control', 'id': device, 'version': info['maxVersion'], 'action': 'next'}
|
|
97
70
|
|
|
@@ -99,7 +72,7 @@ class AudioStation:
|
|
|
99
72
|
|
|
100
73
|
def remote_prev(self, device: str) -> dict[str, object] | str:
|
|
101
74
|
api_name = 'SYNO.AudioStation.RemotePlayer'
|
|
102
|
-
info = self.
|
|
75
|
+
info = self.gen_list[api_name]
|
|
103
76
|
api_path = info['path']
|
|
104
77
|
req_param = {'method': 'control', 'id': device, 'version': info['maxVersion'], 'action': 'prev'}
|
|
105
78
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from typing import Optional
|
|
3
3
|
import requests
|
|
4
|
+
import json
|
|
4
5
|
from .error_codes import error_codes, CODE_SUCCESS, download_station_error_codes, file_station_error_codes
|
|
5
6
|
from .error_codes import auth_error_codes, virtualization_error_codes
|
|
6
7
|
from urllib3 import disable_warnings
|
|
@@ -31,6 +32,7 @@ class Authentication:
|
|
|
31
32
|
self._username: str = username
|
|
32
33
|
self._password: str = password
|
|
33
34
|
self._sid: Optional[str] = None
|
|
35
|
+
self._syno_token: Optional[str] = None
|
|
34
36
|
self._session_expire: bool = True
|
|
35
37
|
self._verify: bool = cert_verify
|
|
36
38
|
self._version: int = dsm_version
|
|
@@ -43,7 +45,6 @@ class Authentication:
|
|
|
43
45
|
|
|
44
46
|
self.full_api_list = {}
|
|
45
47
|
self.app_api_list = {}
|
|
46
|
-
return
|
|
47
48
|
|
|
48
49
|
def verify_cert_enabled(self) -> bool:
|
|
49
50
|
return self._verify
|
|
@@ -51,7 +52,7 @@ class Authentication:
|
|
|
51
52
|
def login(self, application: str) -> None:
|
|
52
53
|
login_api = 'auth.cgi?api=SYNO.API.Auth'
|
|
53
54
|
params = {'version': self._version, 'method': 'login', 'account': self._username,
|
|
54
|
-
'passwd': self._password, 'session': application, 'format': 'cookie'}
|
|
55
|
+
'passwd': self._password, 'session': application, 'format': 'cookie', 'enable_syno_token':'yes'}
|
|
55
56
|
if self._otp_code:
|
|
56
57
|
params['otp_code'] = self._otp_code
|
|
57
58
|
|
|
@@ -82,6 +83,7 @@ class Authentication:
|
|
|
82
83
|
error_code = self._get_error_code(session_request_json)
|
|
83
84
|
if not error_code:
|
|
84
85
|
self._sid = session_request_json['data']['sid']
|
|
86
|
+
self._syno_token = session_request_json['data']['synotoken']
|
|
85
87
|
self._session_expire = False
|
|
86
88
|
if self._debug is True:
|
|
87
89
|
print('User logged in, new session started!')
|
|
@@ -179,6 +181,62 @@ class Authentication:
|
|
|
179
181
|
if print_check == 0:
|
|
180
182
|
print('Not Found')
|
|
181
183
|
return
|
|
184
|
+
|
|
185
|
+
def request_multi_datas(self,
|
|
186
|
+
compound: dict[object] = None,
|
|
187
|
+
method: Optional[str] = None,
|
|
188
|
+
mode: Optional[str] = "sequential", # "sequential" or "parallel"
|
|
189
|
+
response_json: bool = True
|
|
190
|
+
) -> dict[str, object] | str | list | requests.Response: # 'post' or 'get'
|
|
191
|
+
|
|
192
|
+
'''
|
|
193
|
+
Compound is a json structure that contains multiples requests, you can execute them sequential or parallel
|
|
194
|
+
|
|
195
|
+
Example of compound:
|
|
196
|
+
compound = [
|
|
197
|
+
{
|
|
198
|
+
"api": "SYNO.Core.User",
|
|
199
|
+
"method": "list",
|
|
200
|
+
"version": self.core_list["SYNO.Core.User"]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
'''
|
|
204
|
+
api_path = self.full_api_list['SYNO.Entry.Request']['path']
|
|
205
|
+
api_version = self.full_api_list['SYNO.Entry.Request']['maxVersion']
|
|
206
|
+
url = f"{self._base_url}{api_path}"
|
|
207
|
+
|
|
208
|
+
req_param = {
|
|
209
|
+
"api": "SYNO.Entry.Request",
|
|
210
|
+
"method": "request",
|
|
211
|
+
"version": f"{api_version}",
|
|
212
|
+
"mode": mode,
|
|
213
|
+
"stop_when_error": "true",
|
|
214
|
+
"_sid": self._sid,
|
|
215
|
+
"compound": json.dumps(compound)
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if method is None:
|
|
219
|
+
method = 'get'
|
|
220
|
+
|
|
221
|
+
## Request need some headers to work properly
|
|
222
|
+
# X-SYNO-TOKEN is the token that we get when we login
|
|
223
|
+
# We get it from the self._syno_token variable and by param 'enable_syno_token':'yes' in the login request
|
|
224
|
+
|
|
225
|
+
if method == 'get':
|
|
226
|
+
response = requests.get(url, req_param, verify=self._verify, headers={"X-SYNO-TOKEN":self._syno_token})
|
|
227
|
+
elif method == 'post':
|
|
228
|
+
response = requests.post(url, req_param, verify=self._verify, headers={"X-SYNO-TOKEN":self._syno_token})
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
if response_json is True:
|
|
235
|
+
return response.json()
|
|
236
|
+
else:
|
|
237
|
+
return response
|
|
238
|
+
|
|
239
|
+
|
|
182
240
|
|
|
183
241
|
def request_data(self,
|
|
184
242
|
api_name: str,
|
|
@@ -206,9 +264,9 @@ class Authentication:
|
|
|
206
264
|
# Catch and raise our own errors:
|
|
207
265
|
try:
|
|
208
266
|
if method == 'get':
|
|
209
|
-
response = requests.get(url, req_param, verify=self._verify)
|
|
267
|
+
response = requests.get(url, req_param, verify=self._verify, headers={"X-SYNO-TOKEN":self._syno_token})
|
|
210
268
|
elif method == 'post':
|
|
211
|
-
response = requests.post(url, req_param, verify=self._verify)
|
|
269
|
+
response = requests.post(url, req_param, verify=self._verify, headers={"X-SYNO-TOKEN":self._syno_token})
|
|
212
270
|
except requests.exceptions.ConnectionError as e:
|
|
213
271
|
raise SynoConnectionError(error_message=e.args[0])
|
|
214
272
|
except requests.exceptions.HTTPError as e:
|
|
@@ -216,9 +274,9 @@ class Authentication:
|
|
|
216
274
|
else:
|
|
217
275
|
# Will raise its own error:
|
|
218
276
|
if method == 'get':
|
|
219
|
-
response = requests.get(url, req_param, verify=self._verify)
|
|
277
|
+
response = requests.get(url, req_param, verify=self._verify, headers={"X-SYNO-TOKEN":self._syno_token})
|
|
220
278
|
elif method == 'post':
|
|
221
|
-
response = requests.post(url, req_param, verify=self._verify)
|
|
279
|
+
response = requests.post(url, req_param, verify=self._verify, headers={"X-SYNO-TOKEN":self._syno_token})
|
|
222
280
|
|
|
223
281
|
# Check for error response from dsm:
|
|
224
282
|
error_code = 0
|
synology-api-0.6.2/synology_api/base_api_core.py → synology-api-0.7/synology_api/base_api.py
RENAMED
|
@@ -2,7 +2,7 @@ from typing import Optional, Any
|
|
|
2
2
|
from . import auth as syn
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class BaseApi(object):
|
|
6
6
|
def __init__(self,
|
|
7
7
|
ip_address: str,
|
|
8
8
|
port: str,
|
|
@@ -14,6 +14,7 @@ class Core(object):
|
|
|
14
14
|
debug: bool = True,
|
|
15
15
|
otp_code: Optional[str] = None
|
|
16
16
|
) -> None:
|
|
17
|
+
|
|
17
18
|
self.session: syn.Authentication = syn.Authentication(ip_address, port, username, password, secure, cert_verify,
|
|
18
19
|
dsm_version, debug, otp_code)
|
|
19
20
|
self.session.login('Core')
|