# 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/
```
## 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/4b/72/54e485b9b556b4943dc329e9a6754e319b0bbb35dec9e354027ca50b6857/pycti-6.5.2.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\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.5.2",
"project_urls": {
"Homepage": "https://github.com/OpenCTI-Platform/client-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e184f2b57fa9ca280c6c17c2ac6371084bd27f9204f65c6b2b2fb5daea02d276",
"md5": "b4417ed24d3c157e556c21bd4dea5a35",
"sha256": "ed66f61e3af1faef95c2e24bdc2754d9551b0e7b01513ff4c94318936077cfd3"
},
"downloads": -1,
"filename": "pycti-6.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b4417ed24d3c157e556c21bd4dea5a35",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 236181,
"upload_time": "2025-02-17T14:27:08",
"upload_time_iso_8601": "2025-02-17T14:27:08.054414Z",
"url": "https://files.pythonhosted.org/packages/e1/84/f2b57fa9ca280c6c17c2ac6371084bd27f9204f65c6b2b2fb5daea02d276/pycti-6.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4b7254e485b9b556b4943dc329e9a6754e319b0bbb35dec9e354027ca50b6857",
"md5": "fa14b2daa1140305eb039dbe496ff2b3",
"sha256": "955177b4dd889ed38162cacb0f9e5d46dcbb118571c05cf686a50df7d9eed99a"
},
"downloads": -1,
"filename": "pycti-6.5.2.tar.gz",
"has_sig": false,
"md5_digest": "fa14b2daa1140305eb039dbe496ff2b3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 150697,
"upload_time": "2025-02-17T14:27:09",
"upload_time_iso_8601": "2025-02-17T14:27:09.845498Z",
"url": "https://files.pythonhosted.org/packages/4b/72/54e485b9b556b4943dc329e9a6754e319b0bbb35dec9e354027ca50b6857/pycti-6.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-17 14:27:09",
"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": [
[
"~=",
"2.0.4"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"~=",
"6.0"
]
]
},
{
"name": "pydantic",
"specs": [
[
"~=",
"2.10.4"
]
]
},
{
"name": "requests",
"specs": [
[
"~=",
"2.32.2"
]
]
},
{
"name": "setuptools",
"specs": [
[
"~=",
"71.1.0"
]
]
},
{
"name": "cachetools",
"specs": [
[
"~=",
"5.5.0"
]
]
},
{
"name": "prometheus-client",
"specs": [
[
"~=",
"0.21.1"
]
]
},
{
"name": "opentelemetry-api",
"specs": [
[
"~=",
"1.22.0"
]
]
},
{
"name": "opentelemetry-sdk",
"specs": [
[
"~=",
"1.22.0"
]
]
},
{
"name": "deprecation",
"specs": [
[
"~=",
"2.1.0"
]
]
},
{
"name": "filigran-sseclient",
"specs": [
[
">=",
"1.0.2"
]
]
},
{
"name": "stix2",
"specs": [
[
"~=",
"3.0.1"
]
]
}
],
"lcname": "pycti"
}