E360 Clients Core
Installation
Use the E360 Artifactory package manager e360-pypi-local to install clients_core.
Requires Python 3.12 or newer.
pip install clients_core --index-url=https://rwes-artifactory01.internal.imsglobal.com/artifactory/api/pypi/e360-pypi-local/simple
Usage with Service Directory
- Create a TokenHandler, with the right configuration for identity.
from clients_core.authentication.token_handler import OIDCTokenHandler
token_handler = OIDCTokenHandler("<oidc_token_endpoint>", "<oidc_client_id>", "<oidc_client_secret>")
- Create a SecureRestClient for ServiceDirectory, and pass the token handler
from clients_core.secured_rest_client import SecuredRestClient
rest_client = SecuredRestClient("<url-to-service-directory", ["service-dir-scopes"], token_handler)
- Create a ServiceDirectoryClient using the rest client
from sd_clients.service_directory_client import ServiceDirectoryClient
sd_client = ServiceDirectoryClient(rest_client)
- The SD client can now be passed to ApiMatchClient which will allow lookups of services
from clients_core.api_match_client import ApiMatchClient, MatchSpec
match_client = ApiMatchClient(sd_client)
match_spec = MatchSpec("service-name", "endpoint-name",1 ,0, 1, ["service-scopes"])
service_rest_client = match_client.get_secured_client(match_spec, token_handler)
The service rest client can now be passed to a microservice client, or used directly to make REST calls to the target service
Usage with cache
If it is desired to use a cache, we need to wrap our TokenHandler with TokenCache. There are currently two Cache implementations, RedisCache and DictCache.
RedisCache requires a connection URL when instantiated:
from clients_core.authentication.cache import RedisCache
from clients_core.authentication.token_cache import TokenCache
cache = RedisCache("<redis-connection-url>")
token_cache = TokenCache(cache, token_handler) # token handler as created in step .1
token_cache can now be used in place of token_handler.
Development and Testing
Install uv (Python 3.12+ recommended).
uv sync --group dev
Run checks and tests:
uv run ruff check clients_core tests
uv run ruff format --check clients_core tests
uv run pytest
Run a single test file or test:
uv run pytest tests/test_secured_rest_client.py
uv run pytest tests/test_secured_rest_client.py::test_simple_post
Optional type check:
uv run mypy clients_core
Build a wheel locally:
uv build --out-dir dist
On the corporate network, you can point resolution at Artifactory, for example:
export UV_INDEX_URL=https://rwes-artifactory01.internal.imsglobal.com/artifactory/api/pypi/e360-pypi-local/simple
uv sync --group dev
See pyproject.toml for optional explicit e360-pypi indexes when adding internal-only dependencies.
Deployments
Auto CI enabled.
A deployment will happen every time a merge request is merged into master AND the version number is incremented in the clients_core/__init__.py file.
Development
After cloning this repository:
uv sync --group dev
Install pre-commit hooks:
uv run pre-commit install --install-hooks --overwrite
UML
Metadata
Release files for clients-core 4.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clients_core-4.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Release files / clients_core-4.0.4-py3-none-any.whl
| Download URL | clients_core-4.0.4-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b27e385070f28c0ee8562abecf94155c2d9c9dcec7dc628620c5527d6af7b82c
|
|
BLAKE2b-256 checksum How to use checksums |
7ba7b27e1fce1a6ee37c3bb765c3b39817a81bb11bd4be7fbc1274548d04f12a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for clients-core 4.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.