transformerbeeclient


Nametransformerbeeclient JSON
Version 0.1.0 PyPI version JSON
download
home_page
Summaryasync HTTP client to communicate with transformer.bee/edifact-bo4e-converter
upload_time2024-02-06 09:22:38
maintainer
docs_urlNone
author
requires_python>=3.11
licenseMIT
keywords bo4e edifact transformer.bee
VCS
bugtrack_url
requirements No requirements were recorded.
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": "",
    "name": "transformerbeeclient",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "bo4e,edifact,transformer.bee",
    "author": "",
    "author_email": "Hochfrequenz Unternehmensberatung GmbH <info+github@hochfrequenz.de>",
    "download_url": "https://files.pythonhosted.org/packages/cf/19/d4fdbb36888081aece3f7f80bc50b368417c9163470465d3b0eb5412f4d8/transformerbeeclient-0.1.0.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.0",
    "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": "d127b5403ad90fe380278c9adbcc514ac235ba2e33724cbe718ab3db8a3554ee",
                "md5": "9e39dc544ec912a2599bbbad7b9647db",
                "sha256": "2b08a9328884d9a049d6e1dbc6357440501c90860e62fc52493c73954188e541"
            },
            "downloads": -1,
            "filename": "transformerbeeclient-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9e39dc544ec912a2599bbbad7b9647db",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 11522,
            "upload_time": "2024-02-06T09:22:36",
            "upload_time_iso_8601": "2024-02-06T09:22:36.557195Z",
            "url": "https://files.pythonhosted.org/packages/d1/27/b5403ad90fe380278c9adbcc514ac235ba2e33724cbe718ab3db8a3554ee/transformerbeeclient-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf19d4fdbb36888081aece3f7f80bc50b368417c9163470465d3b0eb5412f4d8",
                "md5": "ba5dcb837d939cfd1ae722cbc27359ea",
                "sha256": "1b75333455335a82436b975e0de7f81966d1d1048341c627734d117bfc5bffed"
            },
            "downloads": -1,
            "filename": "transformerbeeclient-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ba5dcb837d939cfd1ae722cbc27359ea",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 20914,
            "upload_time": "2024-02-06T09:22:38",
            "upload_time_iso_8601": "2024-02-06T09:22:38.128121Z",
            "url": "https://files.pythonhosted.org/packages/cf/19/d4fdbb36888081aece3f7f80bc50b368417c9163470465d3b0eb5412f4d8/transformerbeeclient-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-06 09:22:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Hochfrequenz",
    "github_project": "TransformerBeeClient.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "transformerbeeclient"
}
        
Elapsed time: 0.20005s