Commit Graph

32 Commits

Author SHA1 Message Date
efb0716516 Fix MAC address may be empty if NAS uses PPPoE (#93) 2020-10-29 13:51:54 +01:00
fc2bb6cf47 Add Upgrade detail infos (#86)
* get update detail info

* missing new line at the end

* black compliant

* flake8 compliant

* fix pre-commit

* Update tests/api_data/dsm_6/core/const_6_core_upgrade.py

* Update tests/api_data/dsm_6/core/const_6_core_upgrade.py

Co-authored-by: Quentame <polletquentin74@me.com>
2020-10-27 10:45:26 +01:00
336731cbc2 Fix a lot of flake8 linting errors (#85)
* Restore standard ignore list for flake8

In previous version we add some checks to ignore list.

* Fix all B950 flake8 errors (line too long)

Fix the code and add 2 per-file-ignore paterns for readability reasons.

* Fix F401 flake8 errors (import not used)

* Fix E302 flake8 errors

* Fix E266 flake8 errors

* Fix D107 flake8 errors

* Fix Dxxx Flake8 errors

* Add explanation on flake8 ignored rules

* Remove pyling inline ignore rules

pylint is no more used and replaced by flake8.

* Remove D102 flake8 errors.

* Apply suggestions from code review

Co-authored-by: Quentame <polletquentin74@me.com>

Co-authored-by: Quentame <polletquentin74@me.com>
2020-10-25 19:49:10 +01:00
9622f5d314 Migrate to poetry, nox and GitHub actions (#78)
* Replace setup files with pyproject.toml

Now we can use poetry to manage the package.
poetry install to install the package in a venv
poetry run ... to launch pylint, pytest or black

* Add CI with GitHub Action

Add a tests and release workflow
Add release drafter
Add dependabot

* Remove old CI based on travis and pylint

* Add linting configuration files

Linting mainly based on flake8 and plugins.
Add specific files for darglint and mypy.

* Update .gitignore

* Add test suite with nox and pre-commit

Test suite inculde pre-commit, safety, mypy, tests, typguard and documentation
checks.

* Add .gitattributes

* Update code coverage target to 80%

* Code style update by Black

* Update poetry lock file

* Deactivate temporarly some linting tests

* Add a contributing guide

* Remove Python 3.6 in GitHub Action

* Patch noxfile.py to be able to test mypy session

* Rebase version to 1.0.0
2020-10-21 21:38:25 +02:00
c9b8de00c5 Add logout method (#79) 2020-10-20 23:40:57 +02:00
08035384ad Add parameter verify_ssl (#76)
* add parameter ssl_validation

* add parameter ssl_validation

* rename to verify_ssl

* rename to verify_ssl

* object property use_https not needed

* black

* VALID_SSL_VERIFICATION --> VALID_SSL_VERIFY

* disable_warnings on urllib only if not verify_ssl

* VALID_SSL_VERIFY --> VALID_VERIFY_SSL

* VALID_SSL --> VALID_HTTPS

* Add test

* black again

* Add test

Co-authored-by: Quentin POLLET <polletquentin74@me.com>
2020-10-19 23:57:58 +02:00
590f2d9a17 Add Core System and Upgrade APIs info and actions (#72)
* add syno system data and actions

* add system usage examples

* add upgrade information

* Fix default login Exception (#73)

* Migrate to Python 3.6+ (#70)

* Migrate to Python 3.6+

Drop support of Python < 3.6
- remove six + future deps + usage
- update deps
- remove encoding
- remove (object)

* Fix pylint

- pip3 super() style
- remove simplejson dep + usage

* Black format

* lint setup

* Travix CI py version

* Use f string

* Basic Typing

* Revert setup version bump

* correct alphabetically order

* add SynoCoreUpgrade instance

* simplify update_available()

* correct defaults of .get()

* harmonize use of API_KEY

* update docs

* add test data

* due to #70

* update docs

* solve conflict

* add syno system data and actions

* add system usage examples

* add upgrade information

* correct alphabetically order

* add SynoCoreUpgrade instance

* simplify update_available()

* correct defaults of .get()

* harmonize use of API_KEY

* update docs

* add test data

* due to #70

* update docs

* Apply suggestions from code review: function return type

* Don't save previous update data

Co-authored-by: Quentame <polletquentin74@me.com>
2020-10-18 20:01:24 +02:00
212f029478 Migrate to Python 3.6+ (#70)
* Migrate to Python 3.6+

Drop support of Python < 3.6
- remove six + future deps + usage
- update deps
- remove encoding
- remove (object)

* Fix pylint

- pip3 super() style
- remove simplejson dep + usage

* Black format

* lint setup

* Travix CI py version

* Use f string

* Basic Typing

* Revert setup version bump
2020-10-15 00:48:35 +02:00
ce8c2c4e64 Fix default login Exception (#73) 2020-10-14 23:58:38 +02:00
85afea6e12 Add Download Station get_stat() (#68) 2020-09-08 13:35:06 +02:00
ca56dccee9 Add DownloadStation (#62)
* Add DownloadStation

* Add test

* Add resume, fix create

* Add get_config, create destination

* Added readme
2020-09-07 23:26:41 +02:00
27379e7cd6 Add Shared Folders support (#61)
* Minimal Shared Folders support

* Bugfixes in share.py and README updates

* Added tests for shares

* Formatted with black

* Added myself as a contributor.

* Support for extended attributes for shares.

* Tidied up some comments.

* Reformatted with Black

* Fixed tests

* Fixed tests, maybe

* addressing initial feedback on pull request \#61

* Working on tests, can't repro failure locally.

* Updated test per comment on #61 and added a generic to shares.

* Fixed pylint complaint

* Tried to fix the test again, didn\'t

* Ran Black

* Implemented feedback on pull request.

* Updated tests to reflect the move of shares to UUID

* Fix CI

* Rename to SynoCoreShare

* Remove useless _execute_request() special treatment

Co-authored-by: Quentin POLLET <polletquentin74@me.com>
2020-07-12 12:45:28 +02:00
1a012611ff Refactor update: @property does not make I/O, use update() for each API (#59) 2020-06-29 02:17:09 +02:00
660d1e661f Add SurveillanceStation (#57)
* Add SurveillanceStation

* Fix error in error handling

* Fix Python 2.7 pylint

* Capitalize Camera_API.List

Co-authored-by: Xiaonan Shen <s@sxn.dev>

* Capitalize Camera_API.GetSnapshot + id instead of cameraId

Co-authored-by: Xiaonan Shen <s@sxn.dev>

* Join idList

Co-authored-by: Xiaonan Shen <s@sxn.dev>

* black

* pylint

* methods are case sensitive

* Backward compat with Camera.GetSnapshot cameraId

* raw live view data

* Add Info.GetInfo

* Use Camera.GetInfo

* Fix TakeSnapshot blSave

* Fix content type

* Add SurveillanceStation api data

* Add unit test, miss SYNO.SurveillanceStation.Camera GetInfo

* Do not use Camera.LetInfo but .List with max_version 7

* Fix Switch on param

Co-authored-by: Xiaonan Shen <s@sxn.dev>

* Update camera list api data

* Add more API data

* Take care of new test data

* Add RTSP test + previous library code owners

Co-authored-by: Joe Lu <snjoetw@gmail.com>

Co-authored-by: David <dconnor@gmail.com>

Co-authored-by: Aleksander Lyse <aleksander.lyse@gmail.com>

Co-authored-by: Loïc Gerbaud <info@loicg.net>

* Fix Py27 pipe

* Fix : get_all_cameras() test

* Update README for SurveillanceStation

* Fix README
2020-06-29 01:25:05 +02:00
6904c60355 Add request timeout (10s default) (#56) 2020-06-02 13:21:07 +02:00
796a1a7dc5 Add SynoSecurity status_by_check + add outOfDate test (#54) 2020-06-02 10:57:29 +02:00
c96d2b2de0 Fix login with space in password (#50) 2020-05-15 00:31:03 +02:00
9a523c75a2 Make Exceptions detailed (#52) 2020-05-15 00:11:25 +02:00
11512e8df8 Add reset API function (#51)
* Add reset API function

* pylint
2020-05-14 00:18:31 +02:00
e460eb73cb Add API SYNO.Core.SecurityScan.Status (#46) 2020-05-02 15:47:00 +02:00
5f9c2dd96a Add DSM 5 SYNO.DSM.Network test (#45) 2020-05-02 14:56:40 +02:00
a398d3a952 Add API SYNO.DSM.Network (#44) 2020-05-02 11:49:49 +02:00
3fc3ecc6bc Returns unmodified data first, use human_readable=True if needed (#43) 2020-05-02 00:24:07 +02:00
bf6c88912c Fix Storage volume_disk_temp_[X](volume_id) for SHR disks redundancy (#42)
* Fix Storage volume_disk_temp_[X] for SHR disks redundancy

* Fix pylint & black

* Add SHR2 redundancy tests
2020-05-01 13:55:02 +02:00
adba2c3084 Fix : DSM 5 storage "KeyError: 'data'" (#39) 2020-04-29 12:27:44 +02:00
4096d7886b Add DSM 5 tests + fix DSM 5 issues 2020-04-28 22:56:51 +02:00
15697152cc Populated test data from DSM 5.2-5967 Update 9 (#37)
Co-authored-by: aaska <aaska@users.noreply.github.com>

Co-authored-by: Stanislav Toropovskyi <48147949+stast1@users.noreply.github.com>
2020-04-28 13:58:29 +02:00
0622bcf560 Refactor requests (#33)
* API discovery (SYNO.API.Info) + use Exceptions

- remove dsm_version
- use SynologyDSMRequestException for failed requests

* _discover_apis any time

* simplify requests

- Add api.request(api, method, params=None)

* Add connection failed tests

* Finalized ?

* Fix SynologyDSMRequestException not beeing SynologyDSMException

* Fix SynologyDSMAPINotExistsException not beeing SynologyDSMException

* Add Virtual Machine Manager API documentation

* Can get and post request

- Add error handling by API code

* Pylint

* Add get + post tests + SynologyDSMAPIErrorException
2020-04-22 14:00:27 +02:00
e393b1282c Add SYNO.API.Info to test constants + reorganize test consts (#31) 2020-04-14 14:01:58 +02:00
3e28d2049a Add two-step authentication (2SA) login (#29)
+ add login exceptions
+ add Black params
+ add official references creation-update dates
+ add login 2SA tests
+ remove useless "_sid" url prepend
+ remove _execute_get_url append_sid param
+ Require 2SA once, remember granted device ==> skip OTP checking
+ add device_token property to save connected device
2020-04-13 00:26:14 +02:00
a68ef9fe49 Separate DSM 6 test consts + prepare to test DSM 5 (#27) 2020-04-09 21:45:52 +02:00
aa9bba8814 Add tests + some fixes (#23)
* Add tests + some fixes

Fixes:
- [utilization] cpu_total_load returns `None` if one load is 0
- [storage] volume_disk_temp_avg + volume_disk_temp_max were global, not volume related

Add:
- [storage] env
- [storage] storage_pools

Changes:
- api.password is now private
- api.storage_url is now private
- use API_KEY on each of APIs/services

* Fix encoding

* Use future division

* Add test_disk + test_volume to check error handling cases
2020-03-30 23:07:54 +02:00