Python client for the Cylera Partner API
Project description
cylera-client
A Python client for the Cylera Partner API.
Installation
pip install cylera-client
Or with uv:
uv add cylera-client
Usage
from cylera_client import CyleraClient, Inventory, Utilization, Network, Risk, Threat
client = CyleraClient(
username="you@example.com",
password="your-password",
base_url="https://partner.us1.cylera.com/",
)
Authentication is handled automatically. Tokens are cached and refreshed before expiry.
Inventory
inventory = Inventory(client)
# Get a single device by MAC address
device = inventory.get_device("7f:14:22:72:00:e5")
# List devices with optional filters
devices = inventory.get_devices(
vendor="Philips",
device_class="Medical",
page=0,
page_size=50,
)
# Get device attributes
attrs = inventory.get_device_attributes("7f:14:22:72:00:e5")
Utilization
utilization = Utilization(client)
procedures = utilization.get_procedures(
device_uuid="ffc20dfe-4c24-11ec-8a38-5eeeaabea551",
completed_after="2024/01/01",
page=0,
page_size=100,
)
Network
network = Network(client)
subnets = network.get_subnets(vlan=477)
Risk
risk = Risk(client)
# Get vulnerabilities
vulns = risk.get_vulnerabilities(severity="CRITICAL", status="OPEN")
# Get mitigations for a specific CVE
mitigations = risk.get_mitigations(vulnerability="CVE-2017-2852")
Threats
threat = Threat(client)
threats = threat.get_threats(severity="HIGH", status="OPEN", page=0, page_size=50)
Debugging
Set DEBUG=1 to print request details to stderr (authorization headers are redacted):
DEBUG=1 python your_script.py
Development
This project uses uv for dependency management.
# Install dependencies
uv sync --group dev
Running tests
Tests run against the Cylera demo environment. Set the required environment variables first:
export TEST_CYLERA_USERNAME="you@example.com"
export TEST_CYLERA_PASSWORD="your-password"
export TEST_CYLERA_BASE_URL="https://partner.demo.cylera.com/"
Then run the full test suite (pytest, linting, type checking, security scanning):
./test.sh
Or with Doppler for secrets management:
./test.sh --use-doppler
To run pytest only:
uv run pytest -v
Quality checks
The test.sh script runs these checks in order:
| Tool | Purpose |
|---|---|
pytest |
Tests |
ruff |
Linting |
pyright |
Type checking |
shellcheck |
Shell script linting |
bandit |
Python security scanning |
pip-audit |
Dependency vulnerability scanning |
Project details
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 cylera_client-0.2.0.tar.gz.
File metadata
- Download URL: cylera_client-0.2.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5ff503e050480a6111d9019ca1afbc4532ecf280269eb98a346dd5da9df769b
|
|
| MD5 |
c886596ca27cbf74a4a44a03169cf3aa
|
|
| BLAKE2b-256 |
bec3892159e20e02b2473826d750e826ff9bab06ab5389d143fea0f1f0ef7bca
|
File details
Details for the file cylera_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cylera_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88c621af21abacbfb0aaee38c691ce192fa12ded1651e36e27ea890545d508c4
|
|
| MD5 |
f24bd9534d80346801aa99073b3a203b
|
|
| BLAKE2b-256 |
6f8a212fbd0f826e38560cc50dc1946bec6bb6165540a0fb1aad98659abb24f4
|