|
1 | | -# OpenCTI client for Python |
| 1 | +# This repository has been archived |
2 | 2 |
|
3 | | -[](https://opencti.io) |
4 | | -[](https://circleci.com/gh/OpenCTI-Platform/client-python/tree/master) |
5 | | -[](https://opencti-client-for-python.readthedocs.io/en/latest/) |
6 | | -[](https://github.com/OpenCTI-Platform/client-python/releases/latest) |
7 | | -[](https://pypi.python.org/pypi/pycti/) |
8 | | -[](https://community.filigran.io) |
9 | | - |
10 | | -The official OpenCTI Python client helps developers to use the OpenCTI API by providing easy to use methods and utils. |
11 | | -This client is also used by some OpenCTI components. |
12 | | - |
13 | | -## Install |
14 | | - |
15 | | -To install the latest Python client library, please use `pip`: |
16 | | - |
17 | | -```bash |
18 | | -$ pip3 install pycti |
19 | | -``` |
20 | | - |
21 | | -## Local development |
22 | | - |
23 | | -```bash |
24 | | -# Fork the current repository, then clone your fork |
25 | | -$ git clone https://github.com/YOUR-USERNAME/client-python |
26 | | -$ cd client-python |
27 | | -$ git remote add upstream https://github.com/OpenCTI-Platform/client-python.git |
28 | | -# Create a branch for your feature/fix |
29 | | -$ git checkout -b [branch-name] |
30 | | -# Create a virtualenv |
31 | | -$ python3 -m venv .venv |
32 | | -$ source .venv/bin/activate |
33 | | -# Install the client-python and dependencies for the development and the documentation |
34 | | -$ python3 -m pip install -e .[dev,doc] |
35 | | -# Set up the git hook scripts |
36 | | -$ pre-commit install |
37 | | -# Create your feature/fix |
38 | | -# Create tests for your changes |
39 | | -$ pytest |
40 | | -# Push you feature/fix on Github |
41 | | -$ git add [file(s)] |
42 | | -$ git commit -m "[descriptive message]" |
43 | | -$ git push origin [branch-name] |
44 | | -# Open a pull request |
45 | | -``` |
46 | | - |
47 | | -### Install the package locally |
48 | | - |
49 | | -```bash |
50 | | -$ pip install -e . |
51 | | -``` |
52 | | - |
53 | | -## Documentation |
54 | | - |
55 | | -### Client usage |
56 | | - |
57 | | -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). |
58 | | - |
59 | | -### API reference |
60 | | - |
61 | | -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). |
62 | | - |
63 | | -## Tests |
64 | | - |
65 | | -### Install dependencies |
66 | | - |
67 | | -```bash |
68 | | -$ pip install -r ./test-requirements.txt |
69 | | -``` |
70 | | - |
71 | | -[pytest](https://docs.pytest.org/en/7.2.x/) is used to launch the tests. |
72 | | - |
73 | | -### Launch tests |
74 | | - |
75 | | -#### Prerequisite |
76 | | - |
77 | | -Your OpenCTI API should be running. |
78 | | -Your conftest.py should be configured with your API url, your token, and if applicable, your mTLS cert/key. |
79 | | - |
80 | | -#### Launching |
81 | | - |
82 | | -Unit tests |
83 | | -```bash |
84 | | -$ pytest ./tests/01-unit/ |
85 | | -``` |
86 | | - |
87 | | -Integration testing |
88 | | -```bash |
89 | | -$ pytest ./tests/02-integration/ |
90 | | -``` |
91 | | - |
92 | | -Example testing: |
93 | | - |
94 | | -> OpenCTI must be running |
95 | | -
|
96 | | -```bash |
97 | | -cd examples |
98 | | -# Configure with you local instance of OpenCTI |
99 | | -export OPENCTI_API_URL="http://localhost:4000" |
100 | | -export OPENCTI_API_TOKEN="xxxxxxxxxxxxxxxxxxxxxx" |
101 | | - |
102 | | -#Run one example file |
103 | | -python get_indicators_of_malware.py |
104 | | -``` |
| 3 | +You can find all client-python code in the `client-python` directory of [OpenCTI repository](https://github.com/OpenCTI-Platform/opencti) |
105 | 4 |
|
106 | 5 | ## About |
107 | 6 |
|
|
0 commit comments