A lightweight client for an AHBicht powered Backend
Project description
AHBicht Functions Python Client
This repository contains a lightweight client for an AHBicht powered backend by Hochfrequenz.
It does not duplicate the core AHBicht logic but provides a PackageResolver that accesses a database (via a REST API) that stores PackageKeyConditionExpressionMapping
s. The database is maintained by Hochfrequenz.
Internally this client uses and requires aiohttp.
How to use the Client
- Install using pip:
pip install ahbichtfunctionsclient
Then call it
import asyncio
from ahbicht.mapping_results import PackageKeyConditionExpressionMapping
from ahbichtfunctionsclient import HochfrequenzPackageResolver
from maus.edifact import EdifactFormat, EdifactFormatVersion
async def retrieve_package_mwe():
# for a documentation about the purpose of a package resolver, you should read the ahbicht docs
package_resolver = HochfrequenzPackageResolver()
# the following data are just hardcoded to provide you a minimal working example
package_resolver.edifact_format = EdifactFormat.UTILMD
package_resolver.edifact_format_version = EdifactFormatVersion.FV2204
package_mapping = await package_resolver.get_condition_expression("10P") # this does an HTTP GET request
assert isinstance(package_mapping, PackageKeyConditionExpressionMapping) # the result is ahbicht compatible
loop = asyncio.get_event_loop()
loop.run_until_complete(retrieve_package_mwe())
Production Readiness
This package has a 100% code coverage, is linted, statically type checked and PEP561 compatible. It relies on a Hochfrequenz API which is, as of today (2022-03-17), free to use. Hochfrequenz does not give any guarantees regarding the stability or uptime of the API. Also at one point it might require authorization.
How to use this Repository on Your Machine (for development)
Please follow the instructions in our Python Template Repository. tl;dr: tox.
Contribute
You are very welcome to contribute to this template repository by opening a pull request against the main branch.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ahbichtfunctionsclient-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b497e6b2e1f1b7a7ebc30e9150bab54e6fb5473e02f9f0695ed635a1c49099ce |
|
MD5 | 0a6240a1576f24e2ddf7932b1ce3318d |
|
BLAKE2b-256 | 0c00b3a096cdf640ae4f17a6fe2c7a400b49fff9968c986757bf254bc6403de2 |
Hashes for ahbichtfunctionsclient-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6b4f5921fdd4d1aa11385ab06dafd77a6723c2ce2ff720c78713301b124b062 |
|
MD5 | 2af6c596623000fae532ff69821dbfd3 |
|
BLAKE2b-256 | c52d4af77de93f603dac9ac8a216b1dc641b5bd2a5fc4b06dedcb8d57a0e6ac4 |