https://github.com/miaucl/cookidoo-api
An unofficial package to access Cookidoo.
https://github.com/miaucl/cookidoo-api
asyncio cookidoo home-assistant python reverse-engineering
Last synced: 3 months ago
JSON representation
An unofficial package to access Cookidoo.
- Host: GitHub
- URL: https://github.com/miaucl/cookidoo-api
- Owner: miaucl
- License: mit
- Created: 2024-09-15T10:05:26.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-03-31T14:01:54.000Z (3 months ago)
- Last Synced: 2025-04-03T11:44:05.625Z (3 months ago)
- Topics: asyncio, cookidoo, home-assistant, python, reverse-engineering
- Language: Python
- Homepage: https://miaucl.github.io/cookidoo-api/
- Size: 325 KB
- Stars: 21
- Watchers: 5
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Cookidoo API
[](https://pypi.org/p/cookidoo-api)
An unofficial python package to access Cookidoo.
[](https://github.com/miaucl/cookidoo-api/actions/workflows/unit-tests.yaml)
[](https://github.com/miaucl/cookidoo-api/actions/workflows/smoke-test.yaml)
[](https://codecov.io/gh/miaucl/cookidoo-api)
[](https://github.com/miaucl/cookidoo-api/actions/workflows/ruff.yml)
[](https://github.com/miaucl/cookidoo-api/actions/workflows/mypy.yaml)
[](https://github.com/miaucl/cookidoo-api/actions/workflows/markdownlint.yml)[](https://github.com/sponsors/miaucl)
[](https://patreon.com/miaucl)
[](https://buymeacoffee.com/miaucl)
[](https://paypal.me/sponsormiaucl)## Disclaimer
The developers of this module are in no way endorsed by or affiliated with Cookidoo or Vorwerk, or any associated subsidiaries, logos or trademarks.
## Installation
`pip install cookidoo-api`
## Documentation
See below for usage examples.
## Usage Example
The API is based on the `aiohttp` library.
Make sure to have stored your credentials in the top-level file `.env` as such, to loaded by `dotenv`. Alternatively, provide the environment variables by any other `dotenv` compatible means.
```text
[email protected]
PASSWORD=password
```Run the [example script](https://github.com/miaucl/cookidoo-api/blob/master/example.py) and have a look at the inline comments for more explanation.
## Exceptions
In case something goes wrong during a request, several [exceptions](https://github.com/miaucl/cookidoo/blob/master/cookidoo_api/exceptions.py) can be thrown, all inheriting from `CookidooException`.
### Another asyncio event loop is
With the async calls, you might encounter an error that another asyncio event loop is already running on the same thread. This is expected behavior according to the asyncio.run() [documentation](https://docs.python.org/3/library/asyncio-runner.html#asyncio.run). You cannot use more than one aiohttp session per thread, reuse the existing one!
### Exception ignored: RuntimeError: Event loop is closed
Due to a known issue in some versions of aiohttp when using Windows, you might encounter a similar error to this:
```python
Exception ignored in:
Traceback (most recent call last):
File "C:\...\py38\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\...\py38\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\...\py38\lib\asyncio\base_events.py", line 719, in call_soon
self._check_closed()
File "C:\...\py38\lib\asyncio\base_events.py", line 508, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
```You can fix this according to [this](https://stackoverflow.com/questions/68123296/asyncio-throws-runtime-error-with-exception-ignored) StackOverflow answer by adding the following line of code before executing the library:
```python
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
```## Dev
Setup the dev environment using VSCode, it is highly recommended.
```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements_dev.txt
```Install [pre-commit](https://pre-commit.com)
```bash
pre-commit install# Run the commit hooks manually
pre-commit run --all-files
```Following VSCode integrations may be helpful:
- [ruff](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff)
- [mypy](https://marketplace.visualstudio.com/items?itemName=matangover.mypy)
- [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint)### Raw API Requests
The raw requests intercepted between the Cookidoo Android App and the backend can be found here `./docs/raw-api-requests`. They have been used to reconstruct the API which is implemented in this library.
### Releasing
A _final version_ can only be released from the `master` branch. To pass the gates of the `publish` workflow, the version must match in both the `tag` and `cookidoo_api/__init__.py`.
release a prerelease version, it must be done from a feature branch (**not** `master`). Prerelease versions are explicitly marked as such on the GitHub release page.