No project description provided
Project description
KOAP: Lightweight Konnektor Client Library
Messages Logs
Sample Message Logs can be found here: https://spilikin.dev/koap-python/
Configuration using environment variables
Environment variable | Comment |
---|---|
KONNEKTOR_BASE_URL |
Base URL for Konnektor. The connector.sds must be available at {KONNEKTOR_BASE_URL}/connector.sds |
KONNEKTOR_MANDANT_ID |
Context Mandant ID (Tenant) |
KONNEKTOR_CLIENT_SYSTEM_ID |
Context Client System ID |
KONNEKTOR_WORKPLACE_ID |
Context Workplace ID |
KONNEKTOR_USER_ID |
Context UserID (optional) |
Basic Auth | |
KONNEKTOR_AUTH_METHOD |
basic |
KONNEKTOR_AUTH_BASIC_USERNAME |
Username for Basic authentication |
KONNEKTOR_AUTH_BASIC_PASSWORD |
Password for Basic authentication |
Mutual TLS Auth | |
KONNEKTOR_AUTH_METHOD |
cert |
KONNEKTOR_AUTH_CERT_P12_FILENAME |
Path to the PKCS#12 file with client credentials |
KONNEKTOR_AUTH_CERT_P12_PASSWORD |
Password for PKCS#12 file |
export KONNEKTOR_BASE_URL=https://.../
export KONNEKTOR_MANDANT_ID=m1
export KONNEKTOR_CLIENT_SYSTEM_ID=c1
export KONNEKTOR_WORKPLACE_ID=w1
export KONNEKTOR_USER_ID=user1
export KONNEKTOR_AUTH_BASIC_USERNAME=user1
export KONNEKTOR_AUTH_BASIC_PASSWORD='use strong passwords in production'
Once the environmant variables are set, the koap.config.ConnectorConfig
can be instantiated without parameters. We make use of Pydantic Model Config.
from koap.config import ConnectorConfig
from koap.client import ConnectorClient
config = ConnectorConfig()
client = ConnectorClient(config)
event_service = client.create_service_client('EventService', '7.2.0')
cards = event_service.GetCards(client.context())
print(cards)
Configuration in code
from koap.config import ConnectorConfig
from koap.client import ConnectorClient
config = ConnectorConfig(
base_url='https://.../',
mandant_id='m1',
client_system_id='c1',
workplace_id='w1',
user_id='user1',
# Basic Auth
auth_method='basic',
auth_basic_username='user1',
auth_basic_password='use secure passwords in production',
)
client = ConnectorClient(config)
event_service = client.create_service_client('EventService', '7.2.0')
cards = event_service.GetCards(client.context())
print(cards)
VSDM Facade
from koap.facade.vsdm.vsdm_facade import VSDMFacade
from koap.facade.model import CardTypeEnum
from koap.client import ConnectorClient, ConnectorConfig
config = ConnectorConfig()
client = ConnectorClient(config)
vsdm = VSDMFacade(client)
egks = vsdm.get_cards([CardTypeEnum.EGK])
egk_1 = egks[0]
print(egk_1)
smcbs = vsdm.get_cards([CardTypeEnum.SMC_B])
smcb_1 = smcbs[0]
print(smcb_1)
vsd = vsdm.read_vsd(
EhcHandle=egk_1.CardHandle,
HpcHandle=smcb_1.CardHandle,
PerformOnlineCheck=False,
ReadOnlineReceipt=False,
)
print(vsd)
Development
git submodule init
git submodule update
poetry install
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
koap-0.3.1.tar.gz
(331.1 kB
view details)
Built Distribution
koap-0.3.1-py3-none-any.whl
(593.2 kB
view details)
File details
Details for the file koap-0.3.1.tar.gz
.
File metadata
- Download URL: koap-0.3.1.tar.gz
- Upload date:
- Size: 331.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.9 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c3ee6de6eff51f6ad8d051197b9783bd5cc2117857583553ec714bace79df45 |
|
MD5 | d77e91d66494a1298adfb2b2f333e23c |
|
BLAKE2b-256 | a65b84c926c45282a5627dfb8f0cfe049304e20a86d15587d37256184bdbcea9 |
File details
Details for the file koap-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: koap-0.3.1-py3-none-any.whl
- Upload date:
- Size: 593.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.10.9 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a20e0ecf5a00bbe680dd99e4c0dd0b0fa25308a5ad0d5a0f58c38c409ac64bb |
|
MD5 | 76dfc52eb32e8cc6f6141f7ca2274d3d |
|
BLAKE2b-256 | 6c4991cef77c989fbf7ef377efa7383f46d386267cae4132054db9b2cdd19b38 |