transformerbeeclient


Nametransformerbeeclient JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
Summaryasync HTTP client to communicate with transformer.bee/edifact-bo4e-converter
upload_time2024-09-26 10:38:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT
keywords bo4e edifact transformer.bee
VCS
bugtrack_url
requirements aioauth-client aiohttp aiosignal annotated-types anyio attrs brotli certifi frozenlist h11 httpcore httpx idna marshmallow maus more-itertools multidict packaging pydantic pydantic-core pyjwt sniffio typing-extensions yarl
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # transformer.bee Client (Python)

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Python Versions (officially) supported](https://img.shields.io/pypi/pyversions/transformerbeeclient.svg)
![Unittests status badge](https://github.com/Hochfrequenz/TransformerBeeClient.py/workflows/Unittests/badge.svg)
![Coverage status badge](https://github.com/Hochfrequenz/TransformerBeeClient.py/workflows/Coverage/badge.svg)
![Linting status badge](https://github.com/Hochfrequenz/TransformerBeeClient.py/workflows/Linting/badge.svg)
![Black status badge](https://github.com/Hochfrequenz/TransformerBeeClient.py/workflows/Formatting/badge.svg)
![PyPi Status Badge](https://img.shields.io/pypi/v/transformerbeeclient)

This library is a Python HTTP client for transformer.bee aka edifact-bo4e-converter.
We also maintain a [.NET version](https://github.com/Hochfrequenz/TransformerBeeClient.NET) of this client.

It allows you to convert EDIFACT messages to BO4E and vice versa by speaking to Hochfrequenz's transformer.bee service.
Note that the actual conversion happens in the transformer.bee service/backend, this library only provides a convenient way to use its API.

## How to use this library

### Prerequisites / Account

First of all, you need an account to use transformer.bee.
Ask info@hochfrequenz.de or ping [@JoschaMetze](https://github.com/joschametze) on GitHub to get one.

You can check if your account is working by logging [into our stage environment](https://transformerstage.utilibee.io/app/).

### Using the client
Install the library via [pip](https://pypi.org/project/transformerbeeclient/):
```bash
pip install transformerbeeclient
```

### Authentication
As of 2024-02-06 we support either no authentication or OAuth2 client ID/client secret authentication.
Both the unauthenticated and the authenticated client implement the `TransformerBeeClient` protocol, so you can use them interchangeably.

#### No Authentication
If you're hosting transformer.bee in the same network or your localhost and there is no authentication, you can instantiate the client
```python
from yarl import URL
from transformerbeeclient.client import UnauthenticatedTransformerBeeClient

client = UnauthenticatedTransformerBeeClient(base_url=URL("http://localhost:5021"))
```

#### OAuth2 with Client ID/Client Secret
If, which is more likely, Hochfrequenz provided you with a client Id and secret, you can use the `AuthenticatedTransformerBeeClient` class like this:
```python
from yarl import URL
from transformerbeeclient import AuthenticatedTransformerBeeClient

client = AuthenticatedTransformerBeeClient(
    base_url=URL("https://transformer.utilibee.io"),
    client_id="your_client_id",
    client_secret="your_client_secret",
)
```

#### Minimal Working Examples
Find full examples of both conversions in [the integration tests](integrationtests/test_conversion.py).
Find the respective BO4E and EDIFACTs in [the test data folder](integrationtests/TestEdifact).

### Conversion
There are two main methods to convert between EDIFACT and BO4E:
- `edifact_to_bo4e`
- `bo4e_to_edifact`

Both have an `EdifactFormatVersion` as argument (imported from [maus](https://github.com/Hochfrequenz/mig_ahb_utility_stack)), which denotes which version of the EDIFACT format you want to use.
We group all the different versions of the EDIFACT format into an enum, so you can easily choose the one you need.
E.g. `EdifactFormatVersion.FV2310` stands for all MIG/AHB versions valid since 2023-10-01.


#### Convert EDIFACT to BO4E
```python
from maus.edifact import EdifactFormatVersion
# client instantiation goes here

bo4e = await client.edifact_to_bo4e("UNA:+,? 'UNB...", EdifactFormatVersion.FV2310)
```

#### Convert BO4E to EDIFACT
```python
from maus.edifact import EdifactFormatVersion
from transformerbeeclient.models.boneycomb import BOneyComb
# client instantiation goes here

boney_comb = BOneyComb.model_validate({"stammdaten":[...], "transaktionsdaten":{...}})
edifact = await client.bo4e_to_edifact(boney_comb, EdifactFormatVersion.FV2310)
```

## Development
For development of this library, follow the instructions in our [Python Template Repository](https://github.com/Hochfrequenz/python_template_repository).

### Release (CI/CD)

To release a new version of this library, [create a new release](https://github.com/Hochfrequenz/TransformerBeeClient.py/releases/new) in GitHub.
Make sure its tag starts with `v` and the version number, e.g. `v1.2.3`.
Releases are not restricted to the main branch but we prefer them to happen there.

## Contribute
You are very welcome to contribute to this template repository by opening a pull request against the main branch.

## Related Tools and Context
This repository is part of the [Hochfrequenz Libraries and Tools for a truly digitized market communication](https://github.com/Hochfrequenz/digital_market_communication/).

## Hochfrequenz
[Hochfrequenz Unternehmensberatung GmbH](https://www.hochfrequenz.de) is a Grünwald (near Munich) based consulting company with offices in Berlin and Bremen and attractive remote options.
We're not only a main contributor for open source software for German utilities but, according to [Kununu ratings](https://www.kununu.com/de/hochfrequenz-unternehmensberatung1), also among the most attractive employers within the German energy market. Applications of talented developers are welcome at any time!
Please consider visiting our [career page](https://www.hochfrequenz.de/index.php/karriere/aktuelle-stellenausschreibungen/full-stack-entwickler) (German only).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "transformerbeeclient",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "bo4e, edifact, transformer.bee",
    "author": null,
    "author_email": "Hochfrequenz Unternehmensberatung GmbH <info+github@hochfrequenz.de>",
    "download_url": "https://files.pythonhosted.org/packages/9d/fd/0596c98a4cf15ce99b854434739dc553c686bc3adaae46c04153cad7ed61/transformerbeeclient-0.1.1.tar.gz",
    "platform": null,
    "description": "# transformer.bee Client (Python)\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n![Python Versions (officially) supported](https://img.shields.io/pypi/pyversions/transformerbeeclient.svg)\n![Unittests status badge](https://github.com/Hochfrequenz/TransformerBeeClient.py/workflows/Unittests/badge.svg)\n![Coverage status badge](https://github.com/Hochfrequenz/TransformerBeeClient.py/workflows/Coverage/badge.svg)\n![Linting status badge](https://github.com/Hochfrequenz/TransformerBeeClient.py/workflows/Linting/badge.svg)\n![Black status badge](https://github.com/Hochfrequenz/TransformerBeeClient.py/workflows/Formatting/badge.svg)\n![PyPi Status Badge](https://img.shields.io/pypi/v/transformerbeeclient)\n\nThis library is a Python HTTP client for transformer.bee aka edifact-bo4e-converter.\nWe also maintain a [.NET version](https://github.com/Hochfrequenz/TransformerBeeClient.NET) of this client.\n\nIt allows you to convert EDIFACT messages to BO4E and vice versa by speaking to Hochfrequenz's transformer.bee service.\nNote that the actual conversion happens in the transformer.bee service/backend, this library only provides a convenient way to use its API.\n\n## How to use this library\n\n### Prerequisites / Account\n\nFirst of all, you need an account to use transformer.bee.\nAsk info@hochfrequenz.de or ping [@JoschaMetze](https://github.com/joschametze) on GitHub to get one.\n\nYou can check if your account is working by logging [into our stage environment](https://transformerstage.utilibee.io/app/).\n\n### Using the client\nInstall the library via [pip](https://pypi.org/project/transformerbeeclient/):\n```bash\npip install transformerbeeclient\n```\n\n### Authentication\nAs of 2024-02-06 we support either no authentication or OAuth2 client ID/client secret authentication.\nBoth the unauthenticated and the authenticated client implement the `TransformerBeeClient` protocol, so you can use them interchangeably.\n\n#### No Authentication\nIf you're hosting transformer.bee in the same network or your localhost and there is no authentication, you can instantiate the client\n```python\nfrom yarl import URL\nfrom transformerbeeclient.client import UnauthenticatedTransformerBeeClient\n\nclient = UnauthenticatedTransformerBeeClient(base_url=URL(\"http://localhost:5021\"))\n```\n\n#### OAuth2 with Client ID/Client Secret\nIf, which is more likely, Hochfrequenz provided you with a client Id and secret, you can use the `AuthenticatedTransformerBeeClient` class like this:\n```python\nfrom yarl import URL\nfrom transformerbeeclient import AuthenticatedTransformerBeeClient\n\nclient = AuthenticatedTransformerBeeClient(\n    base_url=URL(\"https://transformer.utilibee.io\"),\n    client_id=\"your_client_id\",\n    client_secret=\"your_client_secret\",\n)\n```\n\n#### Minimal Working Examples\nFind full examples of both conversions in [the integration tests](integrationtests/test_conversion.py).\nFind the respective BO4E and EDIFACTs in [the test data folder](integrationtests/TestEdifact).\n\n### Conversion\nThere are two main methods to convert between EDIFACT and BO4E:\n- `edifact_to_bo4e`\n- `bo4e_to_edifact`\n\nBoth have an `EdifactFormatVersion` as argument (imported from [maus](https://github.com/Hochfrequenz/mig_ahb_utility_stack)), which denotes which version of the EDIFACT format you want to use.\nWe group all the different versions of the EDIFACT format into an enum, so you can easily choose the one you need.\nE.g. `EdifactFormatVersion.FV2310` stands for all MIG/AHB versions valid since 2023-10-01.\n\n\n#### Convert EDIFACT to BO4E\n```python\nfrom maus.edifact import EdifactFormatVersion\n# client instantiation goes here\n\nbo4e = await client.edifact_to_bo4e(\"UNA:+,? 'UNB...\", EdifactFormatVersion.FV2310)\n```\n\n#### Convert BO4E to EDIFACT\n```python\nfrom maus.edifact import EdifactFormatVersion\nfrom transformerbeeclient.models.boneycomb import BOneyComb\n# client instantiation goes here\n\nboney_comb = BOneyComb.model_validate({\"stammdaten\":[...], \"transaktionsdaten\":{...}})\nedifact = await client.bo4e_to_edifact(boney_comb, EdifactFormatVersion.FV2310)\n```\n\n## Development\nFor development of this library, follow the instructions in our [Python Template Repository](https://github.com/Hochfrequenz/python_template_repository).\n\n### Release (CI/CD)\n\nTo release a new version of this library, [create a new release](https://github.com/Hochfrequenz/TransformerBeeClient.py/releases/new) in GitHub.\nMake sure its tag starts with `v` and the version number, e.g. `v1.2.3`.\nReleases are not restricted to the main branch but we prefer them to happen there.\n\n## Contribute\nYou are very welcome to contribute to this template repository by opening a pull request against the main branch.\n\n## Related Tools and Context\nThis repository is part of the [Hochfrequenz Libraries and Tools for a truly digitized market communication](https://github.com/Hochfrequenz/digital_market_communication/).\n\n## Hochfrequenz\n[Hochfrequenz Unternehmensberatung GmbH](https://www.hochfrequenz.de) is a Gr\u00fcnwald (near Munich) based consulting company with offices in Berlin and Bremen and attractive remote options.\nWe're not only a main contributor for open source software for German utilities but, according to [Kununu ratings](https://www.kununu.com/de/hochfrequenz-unternehmensberatung1), also among the most attractive employers within the German energy market. Applications of talented developers are welcome at any time!\nPlease consider visiting our [career page](https://www.hochfrequenz.de/index.php/karriere/aktuelle-stellenausschreibungen/full-stack-entwickler) (German only).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "async HTTP client to communicate with transformer.bee/edifact-bo4e-converter",
    "version": "0.1.1",
    "project_urls": {
        "Changelog": "https://github.com/Hochfrequenz/TransformerBeeClient.py/releases",
        "Homepage": "https://github.com/Hochfrequenz/TransformerBeeClient.py"
    },
    "split_keywords": [
        "bo4e",
        " edifact",
        " transformer.bee"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8100afb26efc0ee17b59d8fed5975218726cf23a445f40c0e7d4bb969d45102",
                "md5": "f9135302adca6098fbc7c9bf29cfd31f",
                "sha256": "a4c9f655e30f8aa1453b6719148f0c4f2fa7851db305f5bf9327954915b5ca88"
            },
            "downloads": -1,
            "filename": "transformerbeeclient-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f9135302adca6098fbc7c9bf29cfd31f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 11745,
            "upload_time": "2024-09-26T10:38:53",
            "upload_time_iso_8601": "2024-09-26T10:38:53.181957Z",
            "url": "https://files.pythonhosted.org/packages/e8/10/0afb26efc0ee17b59d8fed5975218726cf23a445f40c0e7d4bb969d45102/transformerbeeclient-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9dfd0596c98a4cf15ce99b854434739dc553c686bc3adaae46c04153cad7ed61",
                "md5": "eb5336dc9e1fb9a9365fe6fbe57d9a98",
                "sha256": "851551dae05b5e9178c9ec2ca94c3b23edbb51c5b4038ffc20f36a36e2bdff8c"
            },
            "downloads": -1,
            "filename": "transformerbeeclient-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "eb5336dc9e1fb9a9365fe6fbe57d9a98",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 20214,
            "upload_time": "2024-09-26T10:38:54",
            "upload_time_iso_8601": "2024-09-26T10:38:54.222101Z",
            "url": "https://files.pythonhosted.org/packages/9d/fd/0596c98a4cf15ce99b854434739dc553c686bc3adaae46c04153cad7ed61/transformerbeeclient-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-26 10:38:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Hochfrequenz",
    "github_project": "TransformerBeeClient.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aioauth-client",
            "specs": [
                [
                    "==",
                    "0.28.1"
                ]
            ]
        },
        {
            "name": "aiohttp",
            "specs": [
                [
                    "==",
                    "3.9.5"
                ]
            ]
        },
        {
            "name": "aiosignal",
            "specs": [
                [
                    "==",
                    "1.3.1"
                ]
            ]
        },
        {
            "name": "annotated-types",
            "specs": [
                [
                    "==",
                    "0.6.0"
                ]
            ]
        },
        {
            "name": "anyio",
            "specs": [
                [
                    "==",
                    "4.3.0"
                ]
            ]
        },
        {
            "name": "attrs",
            "specs": [
                [
                    "==",
                    "23.2.0"
                ]
            ]
        },
        {
            "name": "brotli",
            "specs": [
                [
                    "==",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2024.8.30"
                ]
            ]
        },
        {
            "name": "frozenlist",
            "specs": [
                [
                    "==",
                    "1.4.1"
                ]
            ]
        },
        {
            "name": "h11",
            "specs": [
                [
                    "==",
                    "0.14.0"
                ]
            ]
        },
        {
            "name": "httpcore",
            "specs": [
                [
                    "==",
                    "1.0.5"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    "==",
                    "0.27.0"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.7"
                ]
            ]
        },
        {
            "name": "marshmallow",
            "specs": [
                [
                    "==",
                    "3.20.2"
                ]
            ]
        },
        {
            "name": "maus",
            "specs": [
                [
                    "==",
                    "0.6.1"
                ]
            ]
        },
        {
            "name": "more-itertools",
            "specs": [
                [
                    "==",
                    "10.3.0"
                ]
            ]
        },
        {
            "name": "multidict",
            "specs": [
                [
                    "==",
                    "6.0.5"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "24.1"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    "==",
                    "2.6.4"
                ]
            ]
        },
        {
            "name": "pydantic-core",
            "specs": [
                [
                    "==",
                    "2.16.3"
                ]
            ]
        },
        {
            "name": "pyjwt",
            "specs": [
                [
                    "==",
                    "2.8.0"
                ]
            ]
        },
        {
            "name": "sniffio",
            "specs": [
                [
                    "==",
                    "1.3.1"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    "==",
                    "4.12.2"
                ]
            ]
        },
        {
            "name": "yarl",
            "specs": [
                [
                    "==",
                    "1.9.4"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "transformerbeeclient"
}
        
Elapsed time: 0.48327s