Skip to main content

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.

Auth

# Get the organization associated with your API credentials
org = client.get_organization()
# {"organization_id": 17, "name": "Cylera", "internal_name": "cylera"}

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cylera_client-0.3.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file cylera_client-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: cylera_client-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 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

Hashes for cylera_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ce4b4bbcc05d30b8d17de91f8917f66581650fd54c7def1a7d31da43b0b4f3f
MD5 c7670067da260fd126b100b02be9e330
BLAKE2b-256 82338925c8963d86e9593f5a938ac737b5ecfbdb5d54860f97bf74b5a5688645

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page