# OpenCTI client for Python
[](https://opencti.io)
[](https://circleci.com/gh/OpenCTI-Platform/client-python/tree/master)
[](https://opencti-client-for-python.readthedocs.io/en/latest/)
[](https://github.com/OpenCTI-Platform/client-python/releases/latest)
[](https://pypi.python.org/pypi/pycti/)
[](https://community.filigran.io)
The official OpenCTI Python client helps developers to use the OpenCTI API by providing easy to use methods and utils.
This client is also used by some OpenCTI components.
## Install
To install the latest Python client library, please use `pip`:
```bash
$ pip3 install pycti
```
## Local development
```bash
# Fork the current repository, then clone your fork
$ git clone https://github.com/YOUR-USERNAME/client-python
$ cd client-python
$ git remote add upstream https://github.com/OpenCTI-Platform/client-python.git
# Create a branch for your feature/fix
$ git checkout -b [branch-name]
# Create a virtualenv
$ python3 -m venv .venv
$ source .venv/bin/activate
# Install the client-python and dependencies for the development and the documentation
$ python3 -m pip install -e .[dev,doc]
# Set up the git hook scripts
$ pre-commit install
# Create your feature/fix
# Create tests for your changes
$ pytest
# Push you feature/fix on Github
$ git add [file(s)]
$ git commit -m "[descriptive message]"
$ git push origin [branch-name]
# Open a pull request
```
### Install the package locally
```bash
$ pip install -e .
```
## Documentation
### Client usage
To learn about how to use the OpenCTI Python client and read some examples and cases, refer to [the client documentation](https://opencti-client-for-python.readthedocs.io/en/latest/client_usage/getting_started.html).
### API reference
To learn about the methods available for executing queries and retrieving their answers, refer to [the client API Reference](https://opencti-client-for-python.readthedocs.io/en/latest/pycti/pycti.html).
## Tests
### Install dependencies
```bash
$ pip install -r ./test-requirements.txt
```
[pytest](https://docs.pytest.org/en/7.2.x/) is used to launch the tests.
### Launch tests
#### Prerequisite
Your OpenCTI API should be running.
Your conftest.py should be configured with your API url, your token, and if applicable, your mTLS cert/key.
#### Launching
Unit tests
```bash
$ pytest ./tests/01-unit/
```
Integration testing
```bash
$ pytest ./tests/02-integration/
```
Example testing:
> OpenCTI must be running
```bash
cd examples
# Configure with you local instance of OpenCTI
export OPENCTI_API_URL="http://localhost:4000"
export OPENCTI_API_TOKEN="xxxxxxxxxxxxxxxxxxxxxx"
#Run one example file
python get_indicators_of_malware.py
```
## About
OpenCTI is a product designed and developed by the company [Filigran](https://filigran.io).
<a href="https://filigran.io" alt="Filigran"><img src="https://github.com/OpenCTI-Platform/opencti/raw/master/.github/img/logo_filigran.png" width="300" /></a>
Raw data
{
"_id": null,
"home_page": "https://github.com/OpenCTI-Platform/client-python",
"name": "pycti",
"maintainer": "Filigran",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Filigran",
"author_email": "contact@filigran.io",
"download_url": "https://files.pythonhosted.org/packages/ff/1a/23d7cdcdad3662762b932e45b7d8bf958f626229e8da0b9d936eb18c9ee3/pycti-6.8.10.tar.gz",
"platform": null,
"description": "# OpenCTI client for Python\n\n[](https://opencti.io)\n[](https://circleci.com/gh/OpenCTI-Platform/client-python/tree/master)\n[](https://opencti-client-for-python.readthedocs.io/en/latest/)\n[](https://github.com/OpenCTI-Platform/client-python/releases/latest)\n[](https://pypi.python.org/pypi/pycti/)\n[](https://community.filigran.io)\n\nThe official OpenCTI Python client helps developers to use the OpenCTI API by providing easy to use methods and utils.\nThis client is also used by some OpenCTI components.\n\n## Install\n\nTo install the latest Python client library, please use `pip`:\n\n```bash\n$ pip3 install pycti\n```\n\n## Local development\n\n```bash\n# Fork the current repository, then clone your fork\n$ git clone https://github.com/YOUR-USERNAME/client-python\n$ cd client-python\n$ git remote add upstream https://github.com/OpenCTI-Platform/client-python.git\n# Create a branch for your feature/fix\n$ git checkout -b [branch-name]\n# Create a virtualenv\n$ python3 -m venv .venv\n$ source .venv/bin/activate\n# Install the client-python and dependencies for the development and the documentation\n$ python3 -m pip install -e .[dev,doc]\n# Set up the git hook scripts\n$ pre-commit install\n# Create your feature/fix\n# Create tests for your changes\n$ pytest\n# Push you feature/fix on Github\n$ git add [file(s)]\n$ git commit -m \"[descriptive message]\"\n$ git push origin [branch-name]\n# Open a pull request\n```\n\n### Install the package locally\n\n```bash\n$ pip install -e .\n```\n\n## Documentation\n\n### Client usage\n\nTo learn about how to use the OpenCTI Python client and read some examples and cases, refer to [the client documentation](https://opencti-client-for-python.readthedocs.io/en/latest/client_usage/getting_started.html).\n\n### API reference\n\nTo learn about the methods available for executing queries and retrieving their answers, refer to [the client API Reference](https://opencti-client-for-python.readthedocs.io/en/latest/pycti/pycti.html).\n\n## Tests\n\n### Install dependencies\n\n```bash\n$ pip install -r ./test-requirements.txt\n```\n\n[pytest](https://docs.pytest.org/en/7.2.x/) is used to launch the tests.\n\n### Launch tests\n\n#### Prerequisite\n\nYour OpenCTI API should be running.\nYour conftest.py should be configured with your API url, your token, and if applicable, your mTLS cert/key.\n\n#### Launching\n\nUnit tests\n```bash\n$ pytest ./tests/01-unit/\n```\n\nIntegration testing\n```bash\n$ pytest ./tests/02-integration/\n```\n\nExample testing:\n\n> OpenCTI must be running\n\n```bash\ncd examples\n# Configure with you local instance of OpenCTI\nexport OPENCTI_API_URL=\"http://localhost:4000\"\nexport OPENCTI_API_TOKEN=\"xxxxxxxxxxxxxxxxxxxxxx\"\n\n#Run one example file\npython get_indicators_of_malware.py\n```\n\n## About\n\nOpenCTI is a product designed and developed by the company [Filigran](https://filigran.io).\n\n<a href=\"https://filigran.io\" alt=\"Filigran\"><img src=\"https://github.com/OpenCTI-Platform/opencti/raw/master/.github/img/logo_filigran.png\" width=\"300\" /></a>\n",
"bugtrack_url": null,
"license": "Apache",
"summary": "Python API client for OpenCTI.",
"version": "6.8.10",
"project_urls": {
"Homepage": "https://github.com/OpenCTI-Platform/client-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "39277fbcd92cf03a15de1feeec127076a7884b5446f34c375cc6c4f2226e3187",
"md5": "dca82ce491af6a794c9abf3d151fb1a3",
"sha256": "03fcc8f8ddc57efe47ab5802dc8f00664b50668551cbeeb2b0f2136d85902bf7"
},
"downloads": -1,
"filename": "pycti-6.8.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dca82ce491af6a794c9abf3d151fb1a3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 279321,
"upload_time": "2025-10-30T16:34:56",
"upload_time_iso_8601": "2025-10-30T16:34:56.838801Z",
"url": "https://files.pythonhosted.org/packages/39/27/7fbcd92cf03a15de1feeec127076a7884b5446f34c375cc6c4f2226e3187/pycti-6.8.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ff1a23d7cdcdad3662762b932e45b7d8bf958f626229e8da0b9d936eb18c9ee3",
"md5": "44adf773569f408051f2615f7ed60749",
"sha256": "6fc41f0568220e86494bd786c358573619512ce9002d9a65cc9293a132e3d5a4"
},
"downloads": -1,
"filename": "pycti-6.8.10.tar.gz",
"has_sig": false,
"md5_digest": "44adf773569f408051f2615f7ed60749",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 189028,
"upload_time": "2025-10-30T16:34:58",
"upload_time_iso_8601": "2025-10-30T16:34:58.744999Z",
"url": "https://files.pythonhosted.org/packages/ff/1a/23d7cdcdad3662762b932e45b7d8bf958f626229e8da0b9d936eb18c9ee3/pycti-6.8.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-30 16:34:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "OpenCTI-Platform",
"github_project": "client-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"circle": true,
"requirements": [
{
"name": "datefinder",
"specs": [
[
"~=",
"0.7.3"
]
]
},
{
"name": "pika",
"specs": [
[
"~=",
"1.3.0"
]
]
},
{
"name": "python-magic",
"specs": [
[
"~=",
"0.4.27"
]
]
},
{
"name": "python-magic-bin",
"specs": [
[
"~=",
"0.4.14"
]
]
},
{
"name": "python_json_logger",
"specs": [
[
"~=",
"3.3.0"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"~=",
"6.0"
]
]
},
{
"name": "pydantic",
"specs": [
[
"<",
"3"
],
[
">=",
"2.8.2"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.32.0"
],
[
"<",
"3"
]
]
},
{
"name": "setuptools",
"specs": [
[
"~=",
"80.9.0"
]
]
},
{
"name": "cachetools",
"specs": [
[
"~=",
"5.5.2"
]
]
},
{
"name": "prometheus-client",
"specs": [
[
"~=",
"0.22.1"
]
]
},
{
"name": "opentelemetry-api",
"specs": [
[
"~=",
"1.35.0"
]
]
},
{
"name": "opentelemetry-sdk",
"specs": [
[
"~=",
"1.35.0"
]
]
},
{
"name": "deprecation",
"specs": [
[
"~=",
"2.1.0"
]
]
},
{
"name": "fastapi",
"specs": [
[
">=",
"0.115.2"
],
[
"<",
"1"
]
]
},
{
"name": "uvicorn",
"specs": [
[
"<",
"0.36.0"
],
[
">=",
"0.34.0"
]
]
},
{
"name": "filigran-sseclient",
"specs": [
[
">=",
"1.0.2"
]
]
},
{
"name": "stix2",
"specs": [
[
"~=",
"3.0.1"
]
]
}
],
"lcname": "pycti"
}