Package: transformerbeeclient
transformer.bee Client (Python)This library is a Python HTTP client for transformer.bee aka edifact-bo4e-converter.
We also maintain a.NET versionof 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 libraryPrerequisites / AccountFirst of all, you need an account to use transformer.bee.
Askinfo@hochfrequenz.deor ping@JoschaMetzeon GitHub to get one.You can check if your account is working by logginginto our stage environment.Using the clientInstall the library viapip:pipinstalltransformerbeeclientAuthenticationAs of 2024-02-06 we support either no authentication or OAuth2 client ID/client secret authentication.
Both the unauthenticated and the authenticated client implement theTransformerBeeClientprotocol, so you can use them interchangeably.No AuthenticationIf you're hosting transformer.bee in the same network or your localhost and there is no authentication, you can instantiate the clientfromyarlimportURLfromtransformerbeeclient.clientimportUnauthenticatedTransformerBeeClientclient=UnauthenticatedTransformerBeeClient(base_url=URL("http://localhost:5021"))OAuth2 with Client ID/Client SecretIf, which is more likely, Hochfrequenz provided you with a client Id and secret, you can use theAuthenticatedTransformerBeeClientclass like this:fromyarlimportURLfromtransformerbeeclientimportAuthenticatedTransformerBeeClientclient=AuthenticatedTransformerBeeClient(base_url=URL("https://transformer.utilibee.io"),client_id="your_client_id",client_secret="your_client_secret",)Minimal Working ExamplesFind full examples of both conversions inthe integration tests.
Find the respective BO4E and EDIFACTs inthe test data folder.ConversionThere are two main methods to convert between EDIFACT and BO4E:edifact_to_bo4ebo4e_to_edifactBoth have anEdifactFormatVersionas argument (imported frommaus), 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.FV2310stands for all MIG/AHB versions valid since 2023-10-01.Convert EDIFACT to BO4Efrommaus.edifactimportEdifactFormatVersion# client instantiation goes herebo4e=awaitclient.edifact_to_bo4e("UNA:+,? 'UNB...",EdifactFormatVersion.FV2310)Convert BO4E to EDIFACTfrommaus.edifactimportEdifactFormatVersionfromtransformerbeeclient.models.boneycombimportBOneyComb# client instantiation goes hereboney_comb=BOneyComb.model_validate({"stammdaten":[...],"transaktionsdaten":{...}})edifact=awaitclient.bo4e_to_edifact(boney_comb,EdifactFormatVersion.FV2310)DevelopmentFor development of this library, follow the instructions in ourPython Template Repository.Release (CI/CD)To release a new version of this library,create a new releasein GitHub.
Make sure its tag starts withvand the version number, e.g.v1.2.3.
Releases are not restricted to the main branch but we prefer them to happen there.ContributeYou are very welcome to contribute to this template repository by opening a pull request against the main branch.Related Tools and ContextThis repository is part of theHochfrequenz Libraries and Tools for a truly digitized market communication.HochfrequenzHochfrequenz Unternehmensberatung GmbHis 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 toKununu ratings, also among the most attractive employers within the German energy market. Applications of talented developers are welcome at any time!
Please consider visiting ourcareer page(German only).