Metadata-Version: 2.1
Name: integra-bridge
Version: 0.0.2
Summary: Library allows you to build and connect external processors & connectors to Seventech Integra product
License: MIT
Author: Seventech
Requires-Python: >=3.12,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: fastapi (>=0.111.0,<0.112.0)
Requires-Dist: httpx (>=0.27.0,<0.28.0)
Requires-Dist: pydantic-settings (>=2.3.1,<3.0.0)
Requires-Dist: setuptools (>=71.1.0,<72.0.0)
Description-Content-Type: text/markdown

### **Базовый пример реализации**
Устанавливаем библиотеку
````bash
pip install integra-python-connector
````

Создаем новый процессор:
````python
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!"

````
Инициализируем сам сервис:
````python
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-сервер:
````python
if __name__ == '__main__':
    import uvicorn
    uvicorn.run(app="__main__:application", host='localhost', port=8002)

````
