Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit f6a9e42

Browse files
[client] Adapt client python to limit monitoring impact (#944)
1 parent 0e17613 commit f6a9e42

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

pycti/api/opencti_api_client.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,11 @@ def __init__(self, url, token, log_level="info", ssl_verify=False, proxies={}):
145145
)
146146

147147
def set_applicant_id_header(self, applicant_id):
148-
"""set the request header with the specified token
149-
150-
:param applicant_id: OpenCTI caller id
151-
:type applicant_id: str
152-
"""
153148
self.request_headers["opencti-applicant-id"] = applicant_id
154149

150+
def set_work_id_header(self, work_id):
151+
self.request_headers["opencti-work-id"] = work_id
152+
155153
def set_retry_number(self, retry_number):
156154
self.request_headers["opencti-retry-number"] = (
157155
"" if retry_number is None else str(retry_number)

pycti/api/opencti_api_work.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ def to_received(self, work_id: str, message: str):
1212
query = """
1313
mutation workToReceived($id: ID!, $message: String) {
1414
workEdit(id: $id) {
15-
toReceived (message: $message) {
16-
id
17-
}
15+
toReceived (message: $message)
1816
}
1917
}
2018
"""
@@ -25,9 +23,7 @@ def to_processed(self, work_id: str, message: str, in_error: bool = False):
2523
query = """
2624
mutation workToProcessed($id: ID!, $message: String, $inError: Boolean) {
2725
workEdit(id: $id) {
28-
toProcessed (message: $message, inError: $inError) {
29-
id
30-
}
26+
toProcessed (message: $message, inError: $inError)
3127
}
3228
}
3329
"""
@@ -38,9 +34,7 @@ def report_expectation(self, work_id: str, error):
3834
query = """
3935
mutation reportExpectation($id: ID!, $error: WorkErrorInput) {
4036
workEdit(id: $id) {
41-
reportExpectation(error: $error) {
42-
id
43-
}
37+
reportExpectation(error: $error)
4438
}
4539
}
4640
"""
@@ -56,9 +50,7 @@ def add_expectations(self, work_id: str, expectations: int):
5650
query = """
5751
mutation addExpectations($id: ID!, $expectations: Int) {
5852
workEdit(id: $id) {
59-
addExpectations(expectations: $expectations) {
60-
id
61-
}
53+
addExpectations(expectations: $expectations)
6254
}
6355
}
6456
"""

0 commit comments

Comments
 (0)