cookidoo-api


Namecookidoo-api JSON
Version 0.12.2 PyPI version JSON
download
home_pageNone
SummaryUnofficial package to access Cookidoo.
upload_time2025-01-07 22:07:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT License
keywords cookidoo todo home-assistant iot
VCS
bugtrack_url
requirements aiohttp aiofiles
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cookidoo API

[![PyPI version](https://badge.fury.io/py/cookidoo-api.svg)](https://pypi.org/p/cookidoo-api)

An unofficial python package to access Cookidoo.

[![Unit tests](https://github.com/miaucl/cookidoo-api/actions/workflows/unit-tests.yaml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/unit-tests.yaml)
[![Smoke test](https://github.com/miaucl/cookidoo-api/actions/workflows/smoke-test.yaml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/smoke-test.yaml)
[![Ruff](https://github.com/miaucl/cookidoo-api/actions/workflows/ruff.yml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/ruff.yml)
[![Mypy](https://github.com/miaucl/cookidoo-api/actions/workflows/mypy.yaml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/mypy.yaml)
[![Markdownlint](https://github.com/miaucl/cookidoo-api/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/markdownlint.yml)

[![GitHub](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/miaucl)
[![Patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://patreon.com/miaucl)
[![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/miaucl)
[![PayPal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](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=your@mail.com
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: <function _ProactorBasePipeTransport.__del__ at 0x00000000>
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

It is only possible to release a _final version_ on the `master` branch. For it to pass the gates of the `publish` workflow, it must have the same version in the `tag`, the `cookidoo_api/__init__.py` and an entry in the `CHANGELOG.md` file.

To release a prerelease version, no changelog entry is required, but it can only happen on a feature branch (**not** `master` branch). Also, prerelease versions are marked as such in the github release page.

# CHANGELOG

## 0.12.2

- Fix .co.uk countries which do share a common domain

## 0.12.1

- Add support for recipes which feature ranges for quantity in addition to fixed values

## 0.12.0

- Use sub from jwt as username no longer available at login stage

## 0.11.2

- Fix exotic countries which do share a common domain

## 0.11.1

- Extend smoke tests to multiple accounts with different countries

## 0.11.0

- Align token endpoint with new way of auth for cookidoo app

## 0.10.0

- Use async lib aiofiles to read files from file system

## 0.9.1

- Remove unnecessary python-dotenv from prod requirements

## 0.9.0

- Migrate from TypedDict to dataclass

## 0.8.0

- add collections for managed and custom lists
- add and remove recipes to custom lists
- add calendar/my week with planned recipes

## 0.7.0

- add a method to get the recipe details
- rename the ingredients to ingredient_items to have a logical group of items for the shopping list
- pure ingredients are only a part of the recipe now

## 0.6.0

- add a method to get the recipes on a shopping list

## 0.5.0

- add localization getter for the Cookidoo instance

## 0.4.0

- switch from web automation to proper API (based on Android App)

## 0.3.0

- add check method to quickly verify browser functionality

## 0.2.0

- add method to add items when in free account
- auto-close feedback modal when in free account

## 0.1.1

- fix build

## 0.1.0

Initial commit.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cookidoo-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "cookidoo, todo, home-assistant, iot",
    "author": null,
    "author_email": "Cyrill Raccaud <cyrill.raccaud+pypi@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fd/8f/11edb8d132de2763d6dd5d031ddef86077780b16a4ca906adda9fa0800b4/cookidoo_api-0.12.2.tar.gz",
    "platform": null,
    "description": "# Cookidoo API\n\n[![PyPI version](https://badge.fury.io/py/cookidoo-api.svg)](https://pypi.org/p/cookidoo-api)\n\nAn unofficial python package to access Cookidoo.\n\n[![Unit tests](https://github.com/miaucl/cookidoo-api/actions/workflows/unit-tests.yaml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/unit-tests.yaml)\n[![Smoke test](https://github.com/miaucl/cookidoo-api/actions/workflows/smoke-test.yaml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/smoke-test.yaml)\n[![Ruff](https://github.com/miaucl/cookidoo-api/actions/workflows/ruff.yml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/ruff.yml)\n[![Mypy](https://github.com/miaucl/cookidoo-api/actions/workflows/mypy.yaml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/mypy.yaml)\n[![Markdownlint](https://github.com/miaucl/cookidoo-api/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/miaucl/cookidoo-api/actions/workflows/markdownlint.yml)\n\n[![GitHub](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#EA4AAA)](https://github.com/sponsors/miaucl)\n[![Patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://patreon.com/miaucl)\n[![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/miaucl)\n[![PayPal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/sponsormiaucl)\n\n## Disclaimer\n\nThe developers of this module are in no way endorsed by or affiliated with Cookidoo or Vorwerk, or any associated subsidiaries, logos or trademarks.\n\n## Installation\n\n`pip install cookidoo-api`\n\n## Documentation\n\nSee below for usage examples.\n\n## Usage Example\n\nThe API is based on the `aiohttp` library.\n\nMake 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.\n\n```text\nEMAIL=your@mail.com\nPASSWORD=password\n```\n\nRun the [example script](https://github.com/miaucl/cookidoo-api/blob/master/example.py) and have a look at the inline comments for more explanation.\n\n## Exceptions\n\nIn 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`.\n\n### Another asyncio event loop is\n\nWith 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!\n\n### Exception ignored: RuntimeError: Event loop is closed\n\nDue to a known issue in some versions of aiohttp when using Windows, you might encounter a similar error to this:\n\n```python\nException ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000000>\nTraceback (most recent call last):\n  File \"C:\\...\\py38\\lib\\asyncio\\proactor_events.py\", line 116, in __del__\n    self.close()\n  File \"C:\\...\\py38\\lib\\asyncio\\proactor_events.py\", line 108, in close\n    self._loop.call_soon(self._call_connection_lost, None)\n  File \"C:\\...\\py38\\lib\\asyncio\\base_events.py\", line 719, in call_soon\n    self._check_closed()\n  File \"C:\\...\\py38\\lib\\asyncio\\base_events.py\", line 508, in _check_closed\n    raise RuntimeError('Event loop is closed')\nRuntimeError: Event loop is closed\n```\n\nYou 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:\n\n```python\nasyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\n```\n\n## Dev\n\nSetup the dev environment using VSCode, it is highly recommended.\n\n```bash\npython -m venv .venv\nsource .venv/bin/activate\npip install -r requirements_dev.txt\n```\n\nInstall [pre-commit](https://pre-commit.com)\n\n```bash\npre-commit install\n\n# Run the commit hooks manually\npre-commit run --all-files\n```\n\nFollowing VSCode integrations may be helpful:\n\n- [ruff](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff)\n- [mypy](https://marketplace.visualstudio.com/items?itemName=matangover.mypy)\n- [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint)\n\n### Raw API Requests\n\nThe 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.\n\n### Releasing\n\nIt is only possible to release a _final version_ on the `master` branch. For it to pass the gates of the `publish` workflow, it must have the same version in the `tag`, the `cookidoo_api/__init__.py` and an entry in the `CHANGELOG.md` file.\n\nTo release a prerelease version, no changelog entry is required, but it can only happen on a feature branch (**not** `master` branch). Also, prerelease versions are marked as such in the github release page.\n\n# CHANGELOG\n\n## 0.12.2\n\n- Fix .co.uk countries which do share a common domain\n\n## 0.12.1\n\n- Add support for recipes which feature ranges for quantity in addition to fixed values\n\n## 0.12.0\n\n- Use sub from jwt as username no longer available at login stage\n\n## 0.11.2\n\n- Fix exotic countries which do share a common domain\n\n## 0.11.1\n\n- Extend smoke tests to multiple accounts with different countries\n\n## 0.11.0\n\n- Align token endpoint with new way of auth for cookidoo app\n\n## 0.10.0\n\n- Use async lib aiofiles to read files from file system\n\n## 0.9.1\n\n- Remove unnecessary python-dotenv from prod requirements\n\n## 0.9.0\n\n- Migrate from TypedDict to dataclass\n\n## 0.8.0\n\n- add collections for managed and custom lists\n- add and remove recipes to custom lists\n- add calendar/my week with planned recipes\n\n## 0.7.0\n\n- add a method to get the recipe details\n- rename the ingredients to ingredient_items to have a logical group of items for the shopping list\n- pure ingredients are only a part of the recipe now\n\n## 0.6.0\n\n- add a method to get the recipes on a shopping list\n\n## 0.5.0\n\n- add localization getter for the Cookidoo instance\n\n## 0.4.0\n\n- switch from web automation to proper API (based on Android App)\n\n## 0.3.0\n\n- add check method to quickly verify browser functionality\n\n## 0.2.0\n\n- add method to add items when in free account\n- auto-close feedback modal when in free account\n\n## 0.1.1\n\n- fix build\n\n## 0.1.0\n\nInitial commit.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Unofficial package to access Cookidoo.",
    "version": "0.12.2",
    "project_urls": {
        "Documentation": "https://miaucl.github.io/cookidoo-api/",
        "Issues": "https://github.com/miaucl/cookidoo-api/issues",
        "Source": "https://github.com/miaucl/cookidoo-api"
    },
    "split_keywords": [
        "cookidoo",
        " todo",
        " home-assistant",
        " iot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "35c24850bc739db52acd0d55b66cb1e4496a0b72700f39553c12c6f617439797",
                "md5": "d101c5026217b426ceb73f3586855015",
                "sha256": "959553294a8834b519b52f60e1621195d2c5bd925c4a9e5cb810b717d7541150"
            },
            "downloads": -1,
            "filename": "cookidoo_api-0.12.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d101c5026217b426ceb73f3586855015",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 19252,
            "upload_time": "2025-01-07T22:07:48",
            "upload_time_iso_8601": "2025-01-07T22:07:48.161448Z",
            "url": "https://files.pythonhosted.org/packages/35/c2/4850bc739db52acd0d55b66cb1e4496a0b72700f39553c12c6f617439797/cookidoo_api-0.12.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd8f11edb8d132de2763d6dd5d031ddef86077780b16a4ca906adda9fa0800b4",
                "md5": "e3bd306704c290518de64d2a77200bf7",
                "sha256": "abe65b9280bff81281698f27d6a6b7a29a1863906872f935e6d13c5dbd6307b2"
            },
            "downloads": -1,
            "filename": "cookidoo_api-0.12.2.tar.gz",
            "has_sig": false,
            "md5_digest": "e3bd306704c290518de64d2a77200bf7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 28558,
            "upload_time": "2025-01-07T22:07:49",
            "upload_time_iso_8601": "2025-01-07T22:07:49.996220Z",
            "url": "https://files.pythonhosted.org/packages/fd/8f/11edb8d132de2763d6dd5d031ddef86077780b16a4ca906adda9fa0800b4/cookidoo_api-0.12.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-07 22:07:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "miaucl",
    "github_project": "cookidoo-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aiohttp",
            "specs": [
                [
                    "~=",
                    "3.11"
                ]
            ]
        },
        {
            "name": "aiofiles",
            "specs": [
                [
                    "~=",
                    "24.1.0"
                ]
            ]
        }
    ],
    "lcname": "cookidoo-api"
}
        
Elapsed time: 0.58946s