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.1.tar.gz
(36.4 kB
view details)
Built Distribution
File details
Details for the file integra_bridge-0.0.1.tar.gz
.
File metadata
- Download URL: integra_bridge-0.0.1.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 | d265800ec650a05a339e14da5cabad039200d3a90963c6502c9bb782237b822a |
|
MD5 | 1a3e1d396e45ef5f2ffd230579fef5b8 |
|
BLAKE2b-256 | c3925a89f8383bc3462637bfff60cd53a8b7b33dd07cf0e3c92622430fdc8a57 |
File details
Details for the file integra_bridge-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: integra_bridge-0.0.1-py3-none-any.whl
- Upload date:
- Size: 22.9 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 | 9315e4e20fd4ae4c434e565683cfe2933adc22d4f77bd172901e586f67accd5b |
|
MD5 | f560bc18a922db03583d217d06956ef0 |
|
BLAKE2b-256 | 5cb4686579a0bd17ec4df26f85a8c0d351ef4026bf526bdd6b6b52d83f6e66f1 |