Metadata-Version: 2.4
Name: pyxroad
Version: 1.5.11
Summary: X-Road (Trembita) Python client library for SOAP-based service integration
Author-email: Andrii Shapovalov <mt.andrey@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/AndreyShapovalovVN/pyxroad
Project-URL: Repository, https://github.com/AndreyShapovalovVN/pyxroad.git
Project-URL: Documentation, https://trembita.gov.ua
Keywords: x-road,xroad,trembita,soap,python
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Networking
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
License-File: licenses.md
License-File: third_party/manifest.json
License-File: third_party/licenses/async-timeout/5.0.1/LICENSE
License-File: third_party/licenses/attrs/26.1.0/attrs-26.1.0.dist-info/licenses/LICENSE
License-File: third_party/licenses/certifi/2026.5.20/certifi-2026.5.20.dist-info/licenses/LICENSE
License-File: third_party/licenses/charset-normalizer/3.4.7/charset_normalizer-3.4.7.dist-info/licenses/LICENSE
License-File: third_party/licenses/idna/3.18/idna-3.18.dist-info/licenses/LICENSE.md
License-File: third_party/licenses/isodate/0.7.2/isodate-0.7.2.dist-info/LICENSE
License-File: third_party/licenses/lxml/6.1.1/lxml-6.1.1.dist-info/licenses/LICENSE.txt
License-File: third_party/licenses/lxml/6.1.1/lxml-6.1.1.dist-info/licenses/LICENSES.txt
License-File: third_party/licenses/lxml/6.1.1/resource-notices/RNG2Schtrn.xsl.txt
License-File: third_party/licenses/lxml/6.1.1/resource-notices/XSD2Schtrn.xsl.txt
License-File: third_party/licenses/lxml/6.1.1/resource-notices/iso-schematron.rng.txt
License-File: third_party/licenses/lxml/6.1.1/resource-notices/iso_abstract_expand.xsl.txt
License-File: third_party/licenses/lxml/6.1.1/resource-notices/iso_dsdl_include.xsl.txt
License-File: third_party/licenses/lxml/6.1.1/resource-notices/iso_schematron_message.xsl.txt
License-File: third_party/licenses/lxml/6.1.1/resource-notices/iso_schematron_skeleton_for_xslt1.xsl.txt
License-File: third_party/licenses/lxml/6.1.1/resource-notices/iso_svrl_for_xslt1.xsl.txt
License-File: third_party/licenses/lxml/6.1.1/upstream/doc/licenses/BSD.txt
License-File: third_party/licenses/lxml/6.1.1/upstream/doc/licenses/GPL.txt
License-File: third_party/licenses/lxml/6.1.1/upstream/doc/licenses/elementtree.txt
License-File: third_party/licenses/platformdirs/4.10.0/platformdirs-4.10.0.dist-info/licenses/LICENSE
License-File: third_party/licenses/redis/8.0.1/redis-8.0.1.dist-info/licenses/LICENSE
License-File: third_party/licenses/requests-file/3.0.1/requests_file-3.0.1.dist-info/licenses/LICENSE
License-File: third_party/licenses/requests-toolbelt/1.0.0/requests_toolbelt-1.0.0.dist-info/AUTHORS.rst
License-File: third_party/licenses/requests-toolbelt/1.0.0/requests_toolbelt-1.0.0.dist-info/LICENSE
License-File: third_party/licenses/requests/2.33.0/requests-2.33.0.dist-info/licenses/LICENSE
License-File: third_party/licenses/requests/2.33.0/requests-2.33.0.dist-info/licenses/NOTICE
License-File: third_party/licenses/setuptools/78.1.1/setuptools-78.1.1.dist-info/licenses/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/jaraco.context-5.3.0.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/more_itertools-10.3.0.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/packaging-24.2.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/packaging-24.2.dist-info/LICENSE.APACHE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/packaging-24.2.dist-info/LICENSE.BSD
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/platformdirs-4.2.2.dist-info/licenses/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/tomli-2.0.1.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/typeguard-4.3.0.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/typing_extensions-4.12.2.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/wheel-0.45.1.dist-info/LICENSE.txt
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/wheel/vendored/packaging/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/wheel/vendored/packaging/LICENSE.APACHE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/wheel/vendored/packaging/LICENSE.BSD
License-File: third_party/licenses/setuptools/78.1.1/setuptools/_vendor/zipp-3.19.2.dist-info/LICENSE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/config/NOTICE
License-File: third_party/licenses/setuptools/78.1.1/setuptools/config/_validate_pyproject/NOTICE
License-File: third_party/licenses/supplemental/MPL-2.0.txt
License-File: third_party/licenses/supplemental/libxml2-Copyright.txt
License-File: third_party/licenses/supplemental/libxslt-Copyright.txt
License-File: third_party/licenses/urllib3/2.7.0/urllib3-2.7.0.dist-info/licenses/LICENSE.txt
License-File: third_party/licenses/zeep/4.3.3/zeep-4.3.3.dist-info/licenses/LICENSE
Requires-Dist: lxml>=6.1.1
Requires-Dist: Requests>=2.33.0
Requires-Dist: setuptools>=78.1.1
Requires-Dist: zeep>=4.3.3
Requires-Dist: redis>=8.0.1
Provides-Extra: redis
Requires-Dist: redis>=8.0.1; extra == "redis"
Provides-Extra: dev
Requires-Dist: pytest>=9.1.1; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: mypy>=1.13.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: ruff>=0.15.21; extra == "dev"
Dynamic: license-file

# X-Road (Trembita) Python Client

- **Version:** 1.5.10
- **Web:** https://trembita.gov.ua
- **Repository:** https://github.com/AndreyShapovalovVN/pyxroad
- **Keywords:** x-road, xroad, trembita, python, soap

A powerful Python client library for interacting with X-Road (Trembita) security servers.
This library provides a convenient wrapper around the SOAP-based X-Road protocol, allowing
developers to easily integrate X-Road services into their Python applications.

## Supported Python Versions

- Python 3.10+
- Python 3.11+
- Python 3.12+

## Features

- Easy-to-use SOAP client for X-Road services
- Support for multiple cache backends (SQLite, Redis, In-Memory)
- Automatic SOAP header management
- Transaction ID tracking
- Configurable logging
- Type hints for better IDE support

## Installation and development with uv

Install [uv](https://docs.astral.sh/uv/getting-started/installation/).
To add pyxroad to another uv project:

```bash
uv add git+https://github.com/AndreyShapovalovVN/pyxroad.git
```

To work on this repository:

```bash
git clone https://github.com/AndreyShapovalovVN/pyxroad.git
cd pyxroad
uv sync --locked --extra dev
```

uv creates `.venv` and installs the project and development tools. The
`.python-version` file selects Python 3.12 for development and CI; the library
continues to support Python 3.10+. For runtime dependencies only, use
`uv sync --locked`.

Dependencies are declared in `pyproject.toml`; `uv.lock` records exact versions.
Commit both files when changing dependencies with `uv add`, `uv remove`, or
`uv lock --upgrade-package PACKAGE`. Refresh the component license inventory
when runtime dependencies change. `--locked` rejects a stale lockfile.

## Code Quality Checks

Run the same checks locally as in CI:

```bash
uv run --locked --extra dev python scripts/check_licenses.py
uv run --locked --extra dev ruff check . --extend-exclude 'tests/~*.py'
uv run --locked --extra dev mypy . --ignore-missing-imports --pretty --show-error-codes
uv run --locked --extra dev pytest --maxfail=2 --disable-warnings --ignore-glob='tests/~*.py'
```

## Build and publish

Build using the setuptools version installed from `uv.lock`, then verify that
both distributions contain the license materials:

```bash
uv sync --locked
uv build --no-build-isolation
uv run --locked python scripts/check_licenses.py --dist-dir dist
```

The release workflow runs tests and these checks, then publishes with
`uv publish --trusted-publishing always` using the existing PyPI Trusted Publisher
and `pypi` GitHub environment.

## Quick Start

Basic usage example:

```python
from XRoad import XClient, Transport, SqliteCache
import logging
import sys

# Configure logging
logging.basicConfig(
    stream=sys.stdout,
    level=logging.INFO,
    format='%(asctime)s - %(levelname)s - %(name)s - %(message)s'
)
_logger = logging.getLogger('XRoad')

# Create a client instance
client = XClient(
    ssu="http://security-server:8080",
    client='SEVDEIR-TEST/GOV/00013480/100001',
    service='SEVDEIR-TEST/GOV/00032684/MIA_prod/CheckPassportStatus/v0.1'
)

# Make a service request
try:
    response = client.request(
        xroad_id='ABCD123456',  # Optional: set custom request ID
        PasNumber='AA123456',
        PasSerial='654321'
    )
    _logger.info(f"Response: {response}")
except Exception as err:
    _logger.error(f"Error: {err}")
```

## Advanced Usage

Using custom caching backend:

```python
from XRoad import XClient, Transport, RedisCache

# With Redis cache
redis_cache = RedisCache(path='redis://localhost:6379/0', timeout=3600)
transport = Transport(cache=redis_cache)

client = XClient(
    ssu="http://security-server:8080",
    client='SEVDEIR-TEST/GOV/00013480/100001',
    service='SEVDEIR-TEST/GOV/00032684/MIA_prod/CheckPassportStatus/v0.1',
    transport=transport
)
```

`RedisCache` now has a safe fallback: if `redis` package is not installed or Redis server is unavailable,
it returns `InMemoryCache(timeout=...)` instead of raising an exception.

Setting custom headers:

```python
client.userId = '0123456789'  # Custom user ID
client.id = 'ABCD123456'      # Custom request ID
```

## Available Cache Types

- **InMemoryCache**: Default, stores cache in application memory
- **SqliteCache**: Persistent cache using SQLite database
- **RedisCache**: Distributed cache using Redis

## License

This project is licensed under the [MIT License](LICENSE). Third-party components
retain their own licenses. See the [component inventory](licenses.md) and
[third-party notices and redistribution guidance](THIRD_PARTY_NOTICES.md).

## Support

For issues, questions, and contributions, please visit:
https://github.com/AndreyShapovalovVN/pyxroad
