diff options
Diffstat (limited to 'python-synology-srm.spec')
| -rw-r--r-- | python-synology-srm.spec | 316 |
1 files changed, 316 insertions, 0 deletions
diff --git a/python-synology-srm.spec b/python-synology-srm.spec new file mode 100644 index 0000000..164af17 --- /dev/null +++ b/python-synology-srm.spec @@ -0,0 +1,316 @@ +%global _empty_manifest_terminate_build 0 +Name: python-synology-srm +Version: 0.2.3 +Release: 1 +Summary: Synology SRM API +License: MIT +URL: https://github.com/aerialls/synology-srm +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/9b/0c/01b048e03552a985dad3a01482134f1b2a0bf07cd403c5da075463218f15/synology-srm-0.2.3.tar.gz +BuildArch: noarch + +Requires: python3-requests + +%description + +# Synology SRM API + +[](https://github.com/aerialls/synology-srm/actions?query=workflow%3ATest) +[](https://pypi.org/project/synology-srm/) +[](https://pypi.python.org/pypi/synology-srm/) + +Python 3 library to use the Synology SRM (Synology Router Manager) API. This is **NOT** the same thing as Synology DSM (DiskStation Manager). + +This library should work with the following devices. + +* RT1900ac +* RT2600ac + +> It's not possible to create another account in SRM with admin permissions. You'll need to use your `admin` account (or the one you renamed at creation). + +## Usage + +```python +import synology_srm + +client = synology_srm.Client( + host='192.168.1.254', + port=8001, + https=True, + username='admin', + password='admin', +) +``` + +You can now access all namespaces from the API. The following methods are availabe. + +* Base + * getinfo_encryption() + * query_info() +* Core + * list_ddns_extip() + * list_ddns_record() + * get_system_utilization() + * get_network_nsm_device(filters=`{}`) + * get_ngfw_traffic(interval=`live|day|week|month`) + * list_certificate() + * export_certificate(path=`certificate.zip`) +* Mesh + * get_network_wanstatus() + * get_network_wifidevice() + * get_system_info() + +For instance, to list all endpoints available in the API. + +```python +endpoints = client.base.query_info() + +for endpoint, config in endpoints.items(): + print("API endpoint {} (minVersion={}, maxVersion={})".format( + endpoint, + config['minVersion'], + config['maxVersion'], + )) +``` + +## Manual endpoints + +It's possible to target endpoints not directly supported by this library by using the raw `http` client. + +```python +response = client.http.call( + endpoint='entry.cgi', + api='SYNO.Core.System.Utilization', + method='get', + version=1, +) +``` + +## HTTPS auto-signed certificate + +You can disable the HTTPS certificate verification if you are using a self-signed certificate. + +```python +client.http.disable_https_verify() +``` + + +%package -n python3-synology-srm +Summary: Synology SRM API +Provides: python-synology-srm +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-synology-srm + +# Synology SRM API + +[](https://github.com/aerialls/synology-srm/actions?query=workflow%3ATest) +[](https://pypi.org/project/synology-srm/) +[](https://pypi.python.org/pypi/synology-srm/) + +Python 3 library to use the Synology SRM (Synology Router Manager) API. This is **NOT** the same thing as Synology DSM (DiskStation Manager). + +This library should work with the following devices. + +* RT1900ac +* RT2600ac + +> It's not possible to create another account in SRM with admin permissions. You'll need to use your `admin` account (or the one you renamed at creation). + +## Usage + +```python +import synology_srm + +client = synology_srm.Client( + host='192.168.1.254', + port=8001, + https=True, + username='admin', + password='admin', +) +``` + +You can now access all namespaces from the API. The following methods are availabe. + +* Base + * getinfo_encryption() + * query_info() +* Core + * list_ddns_extip() + * list_ddns_record() + * get_system_utilization() + * get_network_nsm_device(filters=`{}`) + * get_ngfw_traffic(interval=`live|day|week|month`) + * list_certificate() + * export_certificate(path=`certificate.zip`) +* Mesh + * get_network_wanstatus() + * get_network_wifidevice() + * get_system_info() + +For instance, to list all endpoints available in the API. + +```python +endpoints = client.base.query_info() + +for endpoint, config in endpoints.items(): + print("API endpoint {} (minVersion={}, maxVersion={})".format( + endpoint, + config['minVersion'], + config['maxVersion'], + )) +``` + +## Manual endpoints + +It's possible to target endpoints not directly supported by this library by using the raw `http` client. + +```python +response = client.http.call( + endpoint='entry.cgi', + api='SYNO.Core.System.Utilization', + method='get', + version=1, +) +``` + +## HTTPS auto-signed certificate + +You can disable the HTTPS certificate verification if you are using a self-signed certificate. + +```python +client.http.disable_https_verify() +``` + + +%package help +Summary: Development documents and examples for synology-srm +Provides: python3-synology-srm-doc +%description help + +# Synology SRM API + +[](https://github.com/aerialls/synology-srm/actions?query=workflow%3ATest) +[](https://pypi.org/project/synology-srm/) +[](https://pypi.python.org/pypi/synology-srm/) + +Python 3 library to use the Synology SRM (Synology Router Manager) API. This is **NOT** the same thing as Synology DSM (DiskStation Manager). + +This library should work with the following devices. + +* RT1900ac +* RT2600ac + +> It's not possible to create another account in SRM with admin permissions. You'll need to use your `admin` account (or the one you renamed at creation). + +## Usage + +```python +import synology_srm + +client = synology_srm.Client( + host='192.168.1.254', + port=8001, + https=True, + username='admin', + password='admin', +) +``` + +You can now access all namespaces from the API. The following methods are availabe. + +* Base + * getinfo_encryption() + * query_info() +* Core + * list_ddns_extip() + * list_ddns_record() + * get_system_utilization() + * get_network_nsm_device(filters=`{}`) + * get_ngfw_traffic(interval=`live|day|week|month`) + * list_certificate() + * export_certificate(path=`certificate.zip`) +* Mesh + * get_network_wanstatus() + * get_network_wifidevice() + * get_system_info() + +For instance, to list all endpoints available in the API. + +```python +endpoints = client.base.query_info() + +for endpoint, config in endpoints.items(): + print("API endpoint {} (minVersion={}, maxVersion={})".format( + endpoint, + config['minVersion'], + config['maxVersion'], + )) +``` + +## Manual endpoints + +It's possible to target endpoints not directly supported by this library by using the raw `http` client. + +```python +response = client.http.call( + endpoint='entry.cgi', + api='SYNO.Core.System.Utilization', + method='get', + version=1, +) +``` + +## HTTPS auto-signed certificate + +You can disable the HTTPS certificate verification if you are using a self-signed certificate. + +```python +client.http.disable_https_verify() +``` + + +%prep +%autosetup -n synology-srm-0.2.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-synology-srm -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.3-1 +- Package Spec generated |
