Library allows you to build and connect external processors & connectors to Seventech Integra product
Project description
Базовый пример реализации
Устанавливаем библиотеку
pip install integra-python-connector
Создаем новый процессор:
import json
from pathlib import Path
from integra_python_connect.adapters import ProcessorAdapter
from integra_python_connect.dto import SkeletonProcessor, ProcessorView
from integra_python_connect import Bridge
class ExampleProcessor(ProcessorAdapter):
async def execute(self, exchange: str = None):
body = json.loads(exchange["body"]["stringBody"])
body['test'] = 'value'
new_body = json.dumps(body)
exchange["body"]["stringBody"] = new_body
return exchange
async def get_view(self) -> ProcessorView:
skeleton = SkeletonProcessor(type_processor='Example type')
return ProcessorView(
processor_title="Example",
processor_description="Example description",
skeleton_processor=skeleton
)
async def validate(self, exchange: str = None):
return "VALIDATED!"
Инициализируем сам сервис:
bridge = Bridge(
title='Example service',
address='Example address',
description='Example description',
manual_path=Path(__file__).parent / 'manual.pdf'
)
bridge.register_handlers([ExampleProcessor, ])
application = bridge.build()
Запускаем web-сервер:
if __name__ == '__main__':
import uvicorn
uvicorn.run(app="__main__:application", host='localhost', port=8002)
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
integra_bridge-0.0.2.tar.gz
(36.4 kB
view details)
Built Distribution
File details
Details for the file integra_bridge-0.0.2.tar.gz
.
File metadata
- Download URL: integra_bridge-0.0.2.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcb750646df5885d112542da852fb4d3a13a5f676d789265fe3e69d2ae89ae20 |
|
MD5 | 65b873578a891ed654fe28e4fb6c2447 |
|
BLAKE2b-256 | 8f0f573221e1a74fa6aadf8124148078ac86a860da4753b22f7cdd747fcbc9e4 |
File details
Details for the file integra_bridge-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: integra_bridge-0.0.2-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8f2df33435782e38766db2da84390219275dd898188a273544c517eb411f514 |
|
MD5 | 4d11e1499b189cf506bea097230fd025 |
|
BLAKE2b-256 | add272c5d3e4515ba8811033a8d3b73c752abe881277d3acd436655f84417b14 |