openstack-odooclient


Nameopenstack-odooclient JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryPython client library for Odoo and the OpenStack integration add-on.
upload_time2024-07-01 22:37:12
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseApache-2.0
keywords openstack odoo erp billing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OpenStack Odoo Client Library for Python

[![PyPI](https://img.shields.io/pypi/v/openstack-odooclient)](https://pypi.org/project/openstack-odooclient) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openstack-odooclient) [![GitHub](https://img.shields.io/github/license/catalyst-cloud/python-openstack-odooclient)](https://github.com/catalyst-cloud/python-openstack-odooclient/blob/main/LICENSE) ![Test Status](https://img.shields.io/github/actions/workflow/status/catalyst-cloud/python-openstack-odooclient/test.yml?label=tests)

This is an Odoo client library for Python with support for the
[OpenStack Integration add-on](https://github.com/catalyst-cloud/odoo-openstack-integration),
intended to be used by OpenStack projects such as
[Distil](https://github.com/catalyst-cloud/distil).

This library provides a higher level interface than [OdooRPC](https://pythonhosted.org/OdooRPC)
(which is used internally), and is intended to make it possible to develop applications against
a well-defined API, without having to take into account considerations such as backward-incompatible
changes between Odoo versions.

## Installation

The OpenStack Odoo Client library supports Python 3.8 and later.

To install the library package, simply install the
[`openstack-odooclient`](https://pypi.org/project/openstack-odooclient)
package using `pip`.

```bash
python -m pip install openstack-odooclient
```

## Connecting to Odoo

To connect to an Odoo server, create an `openstack_odooclient.Client` object and
pass the connection details to it.

```python
openstack_odooclient.Client(
    *,
    hostname: str,
    database: str,
    username: str,
    password: str,
    protocol: str = "jsonrpc",
    port: int = 8069,
    verify: bool | str | Path = True,
    version: str | None = None,
) -> Client
```

This is the recommended way of creating the Odoo client object,
as it provides some extra parameters for convenience.

```python
from openstack_odooclient import Client as OdooClient

odoo_client = OdooClient(
    hostname="localhost",
    database="odoodb",
    user="test-user",
    password="<password>",
    protocol="jsonrpc",  # HTTP, or "jsonrpc+ssl" for HTTPS.
    port=8069,
    # verify=True,  # Enable/disable SSL verification, or pass the path to a CA certificate.
    # version="14.0",  # Optionally specify the server version. Default is to auto-detect.
)
```

If you have a pre-existing `odoorpc.ODOO` connection object, that can instead
be passed directly into `openstack_odooclient.Client`.

```python
openstack_odooclient.Client(*, odoo: odoorpc.ODOO) -> Client
```

This allows for sharing a single OdooRPC connection object with other code.

```python
from odoorpc import ODOO
from openstack_odooclient import Client as OdooClient

odoo = ODOO(
    host="localhost",
    port=8069,
    protocol="jsonrpc",  # HTTP, or "jsonrpc+ssl" for HTTPS.
    # version="14.0",  # Optionally specify the server version. Default is to auto-detect.
)
odoo.login("odoodb", "test-user", "<password>")

odoo_client = OdooClient(odoo=odoo)
```

## Managers

The Odoo client object exposes a number of record managers, which contain methods
used to query specific record types, or create one or more new records of that type.

For example, performing a simple search query would look something like this:

```python
>>> from openstack_odooclient import Client as OdooClient
>>> odoo_client = OdooClient(
...     hostname="localhost",
...     port=8069,
...     protocol="jsonrpc",
...     database="odoodb",
...     user="test-user",
...     password="<password>",
... )
>>> odoo_client.users.search([("id", "=", odoo_client.user_id)], as_id=True)
[1234]
```

For more information on the available managers and their functions,
check the [Managers](https://catalyst-cloud.github.io/python-openstack-odooclient/latest/managers/index.html) page in the documentation.

## Records

Record manager methods return record objects for the corresponding model
in Odoo.

Record fields can be accessed as attributes on these record objects.
The record classes are fully type hinted, allowing IDEs and validation
tools such as Mypy to verify that your application is using the fields
correctly.

```python
>>> from openstack_odooclient import Client as OdooClient, User
>>> user: User | None = None
>>> odoo_client = OdooClient(
...     hostname="localhost",
...     port=8069,
...     protocol="jsonrpc",
...     database="odoodb",
...     user="test-user",
...     password="<password>",
... )
>>> user = odoo_client.users.get(1234)
>>> user
User(record={'id': 1234, ...}, fields=None)
>>> user.id
1234
```

For more information on the available managers and their functions,
check the [Records](https://catalyst-cloud.github.io/python-openstack-odooclient/latest/managers/index.html#records) section in the documentation.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "openstack-odooclient",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "openstack, odoo, erp, billing",
    "author": null,
    "author_email": "Callum Dickinson <callum.dickinson@catalystcloud.nz>",
    "download_url": "https://files.pythonhosted.org/packages/de/d4/c455a2e95cf4823de21763664262f3a1305993f3c65deaa253d8c7574819/openstack_odooclient-0.1.0.tar.gz",
    "platform": null,
    "description": "# OpenStack Odoo Client Library for Python\n\n[![PyPI](https://img.shields.io/pypi/v/openstack-odooclient)](https://pypi.org/project/openstack-odooclient) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openstack-odooclient) [![GitHub](https://img.shields.io/github/license/catalyst-cloud/python-openstack-odooclient)](https://github.com/catalyst-cloud/python-openstack-odooclient/blob/main/LICENSE) ![Test Status](https://img.shields.io/github/actions/workflow/status/catalyst-cloud/python-openstack-odooclient/test.yml?label=tests)\n\nThis is an Odoo client library for Python with support for the\n[OpenStack Integration add-on](https://github.com/catalyst-cloud/odoo-openstack-integration),\nintended to be used by OpenStack projects such as\n[Distil](https://github.com/catalyst-cloud/distil).\n\nThis library provides a higher level interface than [OdooRPC](https://pythonhosted.org/OdooRPC)\n(which is used internally), and is intended to make it possible to develop applications against\na well-defined API, without having to take into account considerations such as backward-incompatible\nchanges between Odoo versions.\n\n## Installation\n\nThe OpenStack Odoo Client library supports Python 3.8 and later.\n\nTo install the library package, simply install the\n[`openstack-odooclient`](https://pypi.org/project/openstack-odooclient)\npackage using `pip`.\n\n```bash\npython -m pip install openstack-odooclient\n```\n\n## Connecting to Odoo\n\nTo connect to an Odoo server, create an `openstack_odooclient.Client` object and\npass the connection details to it.\n\n```python\nopenstack_odooclient.Client(\n    *,\n    hostname: str,\n    database: str,\n    username: str,\n    password: str,\n    protocol: str = \"jsonrpc\",\n    port: int = 8069,\n    verify: bool | str | Path = True,\n    version: str | None = None,\n) -> Client\n```\n\nThis is the recommended way of creating the Odoo client object,\nas it provides some extra parameters for convenience.\n\n```python\nfrom openstack_odooclient import Client as OdooClient\n\nodoo_client = OdooClient(\n    hostname=\"localhost\",\n    database=\"odoodb\",\n    user=\"test-user\",\n    password=\"<password>\",\n    protocol=\"jsonrpc\",  # HTTP, or \"jsonrpc+ssl\" for HTTPS.\n    port=8069,\n    # verify=True,  # Enable/disable SSL verification, or pass the path to a CA certificate.\n    # version=\"14.0\",  # Optionally specify the server version. Default is to auto-detect.\n)\n```\n\nIf you have a pre-existing `odoorpc.ODOO` connection object, that can instead\nbe passed directly into `openstack_odooclient.Client`.\n\n```python\nopenstack_odooclient.Client(*, odoo: odoorpc.ODOO) -> Client\n```\n\nThis allows for sharing a single OdooRPC connection object with other code.\n\n```python\nfrom odoorpc import ODOO\nfrom openstack_odooclient import Client as OdooClient\n\nodoo = ODOO(\n    host=\"localhost\",\n    port=8069,\n    protocol=\"jsonrpc\",  # HTTP, or \"jsonrpc+ssl\" for HTTPS.\n    # version=\"14.0\",  # Optionally specify the server version. Default is to auto-detect.\n)\nodoo.login(\"odoodb\", \"test-user\", \"<password>\")\n\nodoo_client = OdooClient(odoo=odoo)\n```\n\n## Managers\n\nThe Odoo client object exposes a number of record managers, which contain methods\nused to query specific record types, or create one or more new records of that type.\n\nFor example, performing a simple search query would look something like this:\n\n```python\n>>> from openstack_odooclient import Client as OdooClient\n>>> odoo_client = OdooClient(\n...     hostname=\"localhost\",\n...     port=8069,\n...     protocol=\"jsonrpc\",\n...     database=\"odoodb\",\n...     user=\"test-user\",\n...     password=\"<password>\",\n... )\n>>> odoo_client.users.search([(\"id\", \"=\", odoo_client.user_id)], as_id=True)\n[1234]\n```\n\nFor more information on the available managers and their functions,\ncheck the [Managers](https://catalyst-cloud.github.io/python-openstack-odooclient/latest/managers/index.html) page in the documentation.\n\n## Records\n\nRecord manager methods return record objects for the corresponding model\nin Odoo.\n\nRecord fields can be accessed as attributes on these record objects.\nThe record classes are fully type hinted, allowing IDEs and validation\ntools such as Mypy to verify that your application is using the fields\ncorrectly.\n\n```python\n>>> from openstack_odooclient import Client as OdooClient, User\n>>> user: User | None = None\n>>> odoo_client = OdooClient(\n...     hostname=\"localhost\",\n...     port=8069,\n...     protocol=\"jsonrpc\",\n...     database=\"odoodb\",\n...     user=\"test-user\",\n...     password=\"<password>\",\n... )\n>>> user = odoo_client.users.get(1234)\n>>> user\nUser(record={'id': 1234, ...}, fields=None)\n>>> user.id\n1234\n```\n\nFor more information on the available managers and their functions,\ncheck the [Records](https://catalyst-cloud.github.io/python-openstack-odooclient/latest/managers/index.html#records) section in the documentation.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Python client library for Odoo and the OpenStack integration add-on.",
    "version": "0.1.0",
    "project_urls": {
        "Changelog": "https://catalyst-cloud.github.io/python-openstack-odooclient/latest/changelog.html",
        "Documentation": "https://catalyst-cloud.github.io/python-openstack-odooclient",
        "Homepage": "https://catalyst-cloud.github.io/python-openstack-odooclient",
        "Issues": "https://github.com/catalyst-cloud/python-openstack-odooclient/issues",
        "Repository": "https://github.com/catalyst-cloud/python-openstack-odooclient"
    },
    "split_keywords": [
        "openstack",
        " odoo",
        " erp",
        " billing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "251fa349b77ce58825711c5c918659385995cba5d264dcbcf66f8bf66b74980a",
                "md5": "231964551ae7f080e0396e29621c67b4",
                "sha256": "acb59ddc29ee86dfe0b2eb27d6564ff32e803efd8d3abba4c6391f62a9b58741"
            },
            "downloads": -1,
            "filename": "openstack_odooclient-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "231964551ae7f080e0396e29621c67b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 83380,
            "upload_time": "2024-07-01T22:37:09",
            "upload_time_iso_8601": "2024-07-01T22:37:09.306032Z",
            "url": "https://files.pythonhosted.org/packages/25/1f/a349b77ce58825711c5c918659385995cba5d264dcbcf66f8bf66b74980a/openstack_odooclient-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ded4c455a2e95cf4823de21763664262f3a1305993f3c65deaa253d8c7574819",
                "md5": "0be14b312456170880ce12226519fa1b",
                "sha256": "64f5e973706e7f6e23a6195a359af52ccbdbc012c904f0abf3071b8e2b29dd1d"
            },
            "downloads": -1,
            "filename": "openstack_odooclient-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0be14b312456170880ce12226519fa1b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 106278,
            "upload_time": "2024-07-01T22:37:12",
            "upload_time_iso_8601": "2024-07-01T22:37:12.945267Z",
            "url": "https://files.pythonhosted.org/packages/de/d4/c455a2e95cf4823de21763664262f3a1305993f3c65deaa253d8c7574819/openstack_odooclient-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-01 22:37:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "catalyst-cloud",
    "github_project": "python-openstack-odooclient",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "openstack-odooclient"
}
        
Elapsed time: 0.25166s