X-Road (Trembita) Python client library for SOAP-based service integration
Project description
X-Road (Trembita) Python Client
- Version: 1.5.9
- 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 from GitHub
Using pip:
pip install git+https://github.com/AndreyShapovalovVN/pyxroad.git#egg=pyxroad
Or clone and install locally:
git clone https://github.com/AndreyShapovalovVN/pyxroad.git
cd pyxroad
pip install -e .
Requirements
- lxml >= 5.2.1
- Requests >= 2.32.3
- setuptools >= 68.1.2
- zeep >= 4.0.0
- redis (optional, for Redis cache support)
Code Quality Checks
Run the same checks locally as in CI:
ruff check . --extend-exclude 'tests/~*.py'
mypy . --ignore-missing-imports --pretty --show-error-codes --exclude 'tests/~.*\.py$'
pytest --maxfail=2 --disable-warnings --ignore-glob='tests/~*.py'
Quick Start
Basic usage example:
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:
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:
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 - see the LICENSE file for details.
Support
For issues, questions, and contributions, please visit: https://github.com/AndreyShapovalovVN/pyxroad
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyxroad-1.5.9.tar.gz.
File metadata
- Download URL: pyxroad-1.5.9.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a79a6457afc15d063e8d12a5b35332b81b369a7ab6950820f8fc75cbef2aabbd
|
|
| MD5 |
454cdd1c0ded28a0a970e2c7075b5b4d
|
|
| BLAKE2b-256 |
636e3ad1411e7b60b72cca5ee156c0385c5485defb6f464cebb4a2a960916286
|
Provenance
The following attestation bundles were made for pyxroad-1.5.9.tar.gz:
Publisher:
python-publish.yml on AndreyShapovalovVN/pyxroad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyxroad-1.5.9.tar.gz -
Subject digest:
a79a6457afc15d063e8d12a5b35332b81b369a7ab6950820f8fc75cbef2aabbd - Sigstore transparency entry: 1750484690
- Sigstore integration time:
-
Permalink:
AndreyShapovalovVN/pyxroad@01b9d8851e2b667b445e42004691caa4f136fc4f -
Branch / Tag:
refs/tags/v1.5.9 - Owner: https://github.com/AndreyShapovalovVN
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@01b9d8851e2b667b445e42004691caa4f136fc4f -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyxroad-1.5.9-py3-none-any.whl.
File metadata
- Download URL: pyxroad-1.5.9-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9c499b6f1cdddab4057227288453de9c3421656c48b33c90f28a756d1064e35
|
|
| MD5 |
7eb2c403af550c4506394958b21a70e8
|
|
| BLAKE2b-256 |
349d96b9e2d0b1aa1fe81a7322a9e2cf6b2026ca6509cc1a1169e800bb49db84
|
Provenance
The following attestation bundles were made for pyxroad-1.5.9-py3-none-any.whl:
Publisher:
python-publish.yml on AndreyShapovalovVN/pyxroad
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyxroad-1.5.9-py3-none-any.whl -
Subject digest:
d9c499b6f1cdddab4057227288453de9c3421656c48b33c90f28a756d1064e35 - Sigstore transparency entry: 1750484745
- Sigstore integration time:
-
Permalink:
AndreyShapovalovVN/pyxroad@01b9d8851e2b667b445e42004691caa4f136fc4f -
Branch / Tag:
refs/tags/v1.5.9 - Owner: https://github.com/AndreyShapovalovVN
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@01b9d8851e2b667b445e42004691caa4f136fc4f -
Trigger Event:
release
-
Statement type: