How opencti-platform/client-python works
Project type and purpose
• This is an open-source Python client library (“pycti”) for the OpenCTI platform.
• It provides a high-level, easy-to-use wrapper around the OpenCTI GraphQL API, with modules for API calls, STIX-based entities, connector helpers, and utilities.
File structure
• Top level
• Configuration and CI: .circleci/, .github/, .drone.yml, Makefile, setup files
• docs/: Sphinx documentation source
• examples/: Python scripts showing how to call pycti to interact with OpenCTI
• pycti/: the client library itself, subdivided into api/, connector/, entities/, utils/
• tests/: unit and integration test suites
• Key modules
• pycti/api: GraphQL client, methods grouped by API domain (client, job, notification, workspace, etc.)
• pycti/connector: helper classes to build connectors that sync data to/from OpenCTI
• pycti/entities: classes modeling OpenCTI’s STIX objects (attack patterns, malware, campaigns…)
• pycti/utils: logging, STIX2 helpers, constants, ID management
• Deployment/config
• pyproject.toml, setup.cfg, requirements.txt define packaging and dependencies
• CI workflows (.circleci/config.yml, .github/workflows/*.yml) enforce tests, linting, security scans
• pre-commit, flake8, isort, yamllint for code quality
README for additional insights
• Describes install, local development, testing against a live OpenCTI instance
• Points to usage docs, API reference, and example scripts
• Emphasizes that the library is used by other OpenCTI components
Detailed component breakdown (to include
• User Application / Scripts (examples/)
• pycti Client
• API Client (pycti/api/opencti_api_client.py & domain-specific clients)
• Connector Helper (pycti/connector/opencti_connector_helpers.py)
• Metric Handler (pycti/connector/opencti_metric_handler.py)
• Entities (pycti/entities/*.py mapping STIX domain objects)
• Utils (logging, STIX2 converters, ID management)
• External OpenCTI Platform (GraphQL endpoint)
• CI/CD Pipelines
• GitHub Actions, CircleCI, Drone
• Packaging & Distribution (PyPI)