diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-aionotion.spec | 592 | ||||
| -rw-r--r-- | sources | 1 | 
3 files changed, 594 insertions, 0 deletions
@@ -0,0 +1 @@ +/aionotion-2022.10.0.tar.gz diff --git a/python-aionotion.spec b/python-aionotion.spec new file mode 100644 index 0000000..994cd2e --- /dev/null +++ b/python-aionotion.spec @@ -0,0 +1,592 @@ +%global _empty_manifest_terminate_build 0 +Name:		python-aionotion +Version:	2022.10.0 +Release:	1 +Summary:	A simple Python 3 library for Notion Home Monitoring +License:	MIT +URL:		https://github.com/bachya/aionotion +Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/bd/aa/c0408d007407fa79b34f6a506675f1c1e3204e1abb9d34b98fa59c9dd3c5/aionotion-2022.10.0.tar.gz +BuildArch:	noarch + +Requires:	python3-aiohttp + +%description +# 📟 aionotion: a Python3, asyncio-friendly library for Notion® Home Monitoring + +[](https://github.com/bachya/aionotion/actions) +[](https://pypi.python.org/pypi/aionotion) +[](https://pypi.python.org/pypi/aionotion) +[](https://github.com/bachya/aionotion/blob/main/LICENSE) +[](https://codecov.io/gh/bachya/aionotion) +[](https://codeclimate.com/github/bachya/aionotion/maintainability) +[](https://saythanks.io/to/bachya) + +<a href="https://www.buymeacoffee.com/bachya1208P" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a> + +`aionotion` is a Python 3, asyncio-friendly library for interacting with +[Notion](https://getnotion.com) home monitoring sensors. + +# Python Versions + +`aionotion` is currently supported on: + +- Python 3.9 +- Python 3.10 +- Python 3.11 + +# Installation + +```bash +pip install aionotion +``` + +# Usage + +```python +import asyncio + +from aiohttp import ClientSession + +from aionotion import async_get_client + + +async def main() -> None: +    """Create the aiohttp session and run the example.""" +    client = await async_get_client("<EMAIL>", "<PASSWORD>", session=session) + +    # Get all "households" associated with the account: +    systems = await client.system.async_all() + +    # Get a system by ID: +    system = await client.system.async_get(12345) + +    # Create a system (with associated parameters): +    await client.system.async_create({"system_id": 12345, "name": "Test"}) + +    # Update a system with new parameters: +    await client.system.async_update(12345, {"name": "Test"}) + +    # Delete a system by ID: +    await client.system.async_delete(12345) + +    # Get all bridges associated with the account: +    bridges = await client.bridge.async_all() + +    # Get a bridge by ID: +    bridge = await client.bridge.async_get(12345) + +    # Create a bridge (with associated parameters): +    await client.bridge.async_create({"system_id": 12345, "name": "Test"}) + +    # Update a bridge with new parameters: +    await client.bridge.async_update(12345, {"name": "Test"}) + +    # Reset a bridge (deprovision its WiFi credentials): +    await client.bridge.async_reset(12345) + +    # Delete a bridge by ID: +    await client.bridge.async_delete(12345) + +    # Get all devices associated with the account: +    devices = await client.device.async_all() + +    # Get a device by ID: +    device = await client.device.async_get(12345) + +    # Create a device (with associated parameters): +    await client.device.async_create({"id": 12345}) + +    # Delete a device by ID: +    await client.device.async_delete(12345) + +    # Get all sensors: +    sensors = await client.sensor.async_all() + +    # Get a sensor by ID: +    sensor = await client.sensor.async_get(12345) + +    # Create a sensor (with associated parameters): +    await client.sensor.async_create({"sensor_id": 12345, "name": "Test"}) + +    # Update a sensor with new parameters: +    await client.sensor.async_update(12345, {"name": "Test"}) + +    # Delete a sensor by ID: +    await client.sensor.async_delete(12345) + +    # Get all "tasks" (conditions monitored by sensors) associated with the account: +    tasks = await client.task.async_all() + +    # Get a task by ID: +    task = await client.task.async_get("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") + +    # Get a task's value history between two datetimes: +    import datetime + +    history = await client.task.async_history( +        "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", +        data_before=datetime.datetime.now(), +        data_after=datetime.datetime.now() - datetime.timedelta(days=3), +    ) + +    # Create a list of tasks for a particular sensor (e.g., sensor # 12345): +    await client.task.async_create( +        12345, [{"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "type": "missing"}] +    ) + +    # Delete a task for a particular sensor (e.g., sensor # 12345): +    await client.task.async_delete(12345, "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") + + +asyncio.run(main()) +``` + +By default, the library creates a new connection to Notion with each coroutine. If you +are calling a large number of coroutines (or merely want to squeeze out every second of +runtime savings possible), an +[`aiohttp`](https://github.com/aio-libs/aiohttp) `ClientSession` can be used for connection +pooling: + +```python +import asyncio + +from aiohttp import ClientSession + +from aionotion import async_get_client + + +async def main() -> None: +    """Create the aiohttp session and run the example.""" +    async with ClientSession() as session: +        # Create a Notion API client: +        client = await async_get_client("<EMAIL>", "<PASSWORD>", session=session) + +        # Get to work... + + +asyncio.run(main()) +``` + +Check out the examples, the tests, and the source files themselves for method +signatures and more examples. + +# Contributing + +1. [Check for open features/bugs](https://github.com/bachya/aionotion/issues) +   or [initiate a discussion on one](https://github.com/bachya/aionotion/issues/new). +2. [Fork the repository](https://github.com/bachya/aionotion/fork). +3. (_optional, but highly recommended_) Create a virtual environment: `python3 -m venv .venv` +4. (_optional, but highly recommended_) Enter the virtual environment: `source ./venv/bin/activate` +5. Install the dev environment: `script/setup` +6. Code your new feature or bug fix. +7. Write tests that cover your new functionality. +8. Run tests and ensure 100% code coverage: `poetry run pytest --cov aionotion tests` +9. Update `README.md` with any new documentation. +10. Add yourself to `AUTHORS.md`. +11. Submit a pull request! + + +%package -n python3-aionotion +Summary:	A simple Python 3 library for Notion Home Monitoring +Provides:	python-aionotion +BuildRequires:	python3-devel +BuildRequires:	python3-setuptools +BuildRequires:	python3-pip +%description -n python3-aionotion +# 📟 aionotion: a Python3, asyncio-friendly library for Notion® Home Monitoring + +[](https://github.com/bachya/aionotion/actions) +[](https://pypi.python.org/pypi/aionotion) +[](https://pypi.python.org/pypi/aionotion) +[](https://github.com/bachya/aionotion/blob/main/LICENSE) +[](https://codecov.io/gh/bachya/aionotion) +[](https://codeclimate.com/github/bachya/aionotion/maintainability) +[](https://saythanks.io/to/bachya) + +<a href="https://www.buymeacoffee.com/bachya1208P" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a> + +`aionotion` is a Python 3, asyncio-friendly library for interacting with +[Notion](https://getnotion.com) home monitoring sensors. + +# Python Versions + +`aionotion` is currently supported on: + +- Python 3.9 +- Python 3.10 +- Python 3.11 + +# Installation + +```bash +pip install aionotion +``` + +# Usage + +```python +import asyncio + +from aiohttp import ClientSession + +from aionotion import async_get_client + + +async def main() -> None: +    """Create the aiohttp session and run the example.""" +    client = await async_get_client("<EMAIL>", "<PASSWORD>", session=session) + +    # Get all "households" associated with the account: +    systems = await client.system.async_all() + +    # Get a system by ID: +    system = await client.system.async_get(12345) + +    # Create a system (with associated parameters): +    await client.system.async_create({"system_id": 12345, "name": "Test"}) + +    # Update a system with new parameters: +    await client.system.async_update(12345, {"name": "Test"}) + +    # Delete a system by ID: +    await client.system.async_delete(12345) + +    # Get all bridges associated with the account: +    bridges = await client.bridge.async_all() + +    # Get a bridge by ID: +    bridge = await client.bridge.async_get(12345) + +    # Create a bridge (with associated parameters): +    await client.bridge.async_create({"system_id": 12345, "name": "Test"}) + +    # Update a bridge with new parameters: +    await client.bridge.async_update(12345, {"name": "Test"}) + +    # Reset a bridge (deprovision its WiFi credentials): +    await client.bridge.async_reset(12345) + +    # Delete a bridge by ID: +    await client.bridge.async_delete(12345) + +    # Get all devices associated with the account: +    devices = await client.device.async_all() + +    # Get a device by ID: +    device = await client.device.async_get(12345) + +    # Create a device (with associated parameters): +    await client.device.async_create({"id": 12345}) + +    # Delete a device by ID: +    await client.device.async_delete(12345) + +    # Get all sensors: +    sensors = await client.sensor.async_all() + +    # Get a sensor by ID: +    sensor = await client.sensor.async_get(12345) + +    # Create a sensor (with associated parameters): +    await client.sensor.async_create({"sensor_id": 12345, "name": "Test"}) + +    # Update a sensor with new parameters: +    await client.sensor.async_update(12345, {"name": "Test"}) + +    # Delete a sensor by ID: +    await client.sensor.async_delete(12345) + +    # Get all "tasks" (conditions monitored by sensors) associated with the account: +    tasks = await client.task.async_all() + +    # Get a task by ID: +    task = await client.task.async_get("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") + +    # Get a task's value history between two datetimes: +    import datetime + +    history = await client.task.async_history( +        "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", +        data_before=datetime.datetime.now(), +        data_after=datetime.datetime.now() - datetime.timedelta(days=3), +    ) + +    # Create a list of tasks for a particular sensor (e.g., sensor # 12345): +    await client.task.async_create( +        12345, [{"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "type": "missing"}] +    ) + +    # Delete a task for a particular sensor (e.g., sensor # 12345): +    await client.task.async_delete(12345, "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") + + +asyncio.run(main()) +``` + +By default, the library creates a new connection to Notion with each coroutine. If you +are calling a large number of coroutines (or merely want to squeeze out every second of +runtime savings possible), an +[`aiohttp`](https://github.com/aio-libs/aiohttp) `ClientSession` can be used for connection +pooling: + +```python +import asyncio + +from aiohttp import ClientSession + +from aionotion import async_get_client + + +async def main() -> None: +    """Create the aiohttp session and run the example.""" +    async with ClientSession() as session: +        # Create a Notion API client: +        client = await async_get_client("<EMAIL>", "<PASSWORD>", session=session) + +        # Get to work... + + +asyncio.run(main()) +``` + +Check out the examples, the tests, and the source files themselves for method +signatures and more examples. + +# Contributing + +1. [Check for open features/bugs](https://github.com/bachya/aionotion/issues) +   or [initiate a discussion on one](https://github.com/bachya/aionotion/issues/new). +2. [Fork the repository](https://github.com/bachya/aionotion/fork). +3. (_optional, but highly recommended_) Create a virtual environment: `python3 -m venv .venv` +4. (_optional, but highly recommended_) Enter the virtual environment: `source ./venv/bin/activate` +5. Install the dev environment: `script/setup` +6. Code your new feature or bug fix. +7. Write tests that cover your new functionality. +8. Run tests and ensure 100% code coverage: `poetry run pytest --cov aionotion tests` +9. Update `README.md` with any new documentation. +10. Add yourself to `AUTHORS.md`. +11. Submit a pull request! + + +%package help +Summary:	Development documents and examples for aionotion +Provides:	python3-aionotion-doc +%description help +# 📟 aionotion: a Python3, asyncio-friendly library for Notion® Home Monitoring + +[](https://github.com/bachya/aionotion/actions) +[](https://pypi.python.org/pypi/aionotion) +[](https://pypi.python.org/pypi/aionotion) +[](https://github.com/bachya/aionotion/blob/main/LICENSE) +[](https://codecov.io/gh/bachya/aionotion) +[](https://codeclimate.com/github/bachya/aionotion/maintainability) +[](https://saythanks.io/to/bachya) + +<a href="https://www.buymeacoffee.com/bachya1208P" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a> + +`aionotion` is a Python 3, asyncio-friendly library for interacting with +[Notion](https://getnotion.com) home monitoring sensors. + +# Python Versions + +`aionotion` is currently supported on: + +- Python 3.9 +- Python 3.10 +- Python 3.11 + +# Installation + +```bash +pip install aionotion +``` + +# Usage + +```python +import asyncio + +from aiohttp import ClientSession + +from aionotion import async_get_client + + +async def main() -> None: +    """Create the aiohttp session and run the example.""" +    client = await async_get_client("<EMAIL>", "<PASSWORD>", session=session) + +    # Get all "households" associated with the account: +    systems = await client.system.async_all() + +    # Get a system by ID: +    system = await client.system.async_get(12345) + +    # Create a system (with associated parameters): +    await client.system.async_create({"system_id": 12345, "name": "Test"}) + +    # Update a system with new parameters: +    await client.system.async_update(12345, {"name": "Test"}) + +    # Delete a system by ID: +    await client.system.async_delete(12345) + +    # Get all bridges associated with the account: +    bridges = await client.bridge.async_all() + +    # Get a bridge by ID: +    bridge = await client.bridge.async_get(12345) + +    # Create a bridge (with associated parameters): +    await client.bridge.async_create({"system_id": 12345, "name": "Test"}) + +    # Update a bridge with new parameters: +    await client.bridge.async_update(12345, {"name": "Test"}) + +    # Reset a bridge (deprovision its WiFi credentials): +    await client.bridge.async_reset(12345) + +    # Delete a bridge by ID: +    await client.bridge.async_delete(12345) + +    # Get all devices associated with the account: +    devices = await client.device.async_all() + +    # Get a device by ID: +    device = await client.device.async_get(12345) + +    # Create a device (with associated parameters): +    await client.device.async_create({"id": 12345}) + +    # Delete a device by ID: +    await client.device.async_delete(12345) + +    # Get all sensors: +    sensors = await client.sensor.async_all() + +    # Get a sensor by ID: +    sensor = await client.sensor.async_get(12345) + +    # Create a sensor (with associated parameters): +    await client.sensor.async_create({"sensor_id": 12345, "name": "Test"}) + +    # Update a sensor with new parameters: +    await client.sensor.async_update(12345, {"name": "Test"}) + +    # Delete a sensor by ID: +    await client.sensor.async_delete(12345) + +    # Get all "tasks" (conditions monitored by sensors) associated with the account: +    tasks = await client.task.async_all() + +    # Get a task by ID: +    task = await client.task.async_get("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") + +    # Get a task's value history between two datetimes: +    import datetime + +    history = await client.task.async_history( +        "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", +        data_before=datetime.datetime.now(), +        data_after=datetime.datetime.now() - datetime.timedelta(days=3), +    ) + +    # Create a list of tasks for a particular sensor (e.g., sensor # 12345): +    await client.task.async_create( +        12345, [{"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "type": "missing"}] +    ) + +    # Delete a task for a particular sensor (e.g., sensor # 12345): +    await client.task.async_delete(12345, "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") + + +asyncio.run(main()) +``` + +By default, the library creates a new connection to Notion with each coroutine. If you +are calling a large number of coroutines (or merely want to squeeze out every second of +runtime savings possible), an +[`aiohttp`](https://github.com/aio-libs/aiohttp) `ClientSession` can be used for connection +pooling: + +```python +import asyncio + +from aiohttp import ClientSession + +from aionotion import async_get_client + + +async def main() -> None: +    """Create the aiohttp session and run the example.""" +    async with ClientSession() as session: +        # Create a Notion API client: +        client = await async_get_client("<EMAIL>", "<PASSWORD>", session=session) + +        # Get to work... + + +asyncio.run(main()) +``` + +Check out the examples, the tests, and the source files themselves for method +signatures and more examples. + +# Contributing + +1. [Check for open features/bugs](https://github.com/bachya/aionotion/issues) +   or [initiate a discussion on one](https://github.com/bachya/aionotion/issues/new). +2. [Fork the repository](https://github.com/bachya/aionotion/fork). +3. (_optional, but highly recommended_) Create a virtual environment: `python3 -m venv .venv` +4. (_optional, but highly recommended_) Enter the virtual environment: `source ./venv/bin/activate` +5. Install the dev environment: `script/setup` +6. Code your new feature or bug fix. +7. Write tests that cover your new functionality. +8. Run tests and ensure 100% code coverage: `poetry run pytest --cov aionotion tests` +9. Update `README.md` with any new documentation. +10. Add yourself to `AUTHORS.md`. +11. Submit a pull request! + + +%prep +%autosetup -n aionotion-2022.10.0 + +%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-aionotion -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Mar 07 2023 Python_Bot <Python_Bot@openeuler.org> - 2022.10.0-1 +- Package Spec generated @@ -0,0 +1 @@ +9425f11828210c9b04beba1b06ee3d80  aionotion-2022.10.0.tar.gz  | 
