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

Commit 0b9540e

Browse files
committed
[client] Adapt methods of import
1 parent a5ca143 commit 0b9540e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pycti/utils/opencti_stix2.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ def import_bundle_from_json(
202202
:return: list of imported stix2 objects
203203
:rtype: List
204204
"""
205-
self.opencti.set_retry_number(retry_number)
206205
data = json.loads(json_data)
207206
return self.import_bundle(
208207
data,
209208
update,
210209
types,
210+
retry_number,
211211
)
212212

213213
def resolve_author(self, title: str) -> Optional[Identity]:
@@ -1696,7 +1696,11 @@ def export_list(
16961696
return bundle
16971697

16981698
def import_bundle(
1699-
self, stix_bundle: Dict, update: bool = False, types: List = None
1699+
self,
1700+
stix_bundle: Dict,
1701+
update: bool = False,
1702+
types: List = None,
1703+
retry_number: int = None,
17001704
) -> List:
17011705
# Check if the bundle is correctly formatted
17021706
if "type" not in stix_bundle or stix_bundle["type"] != "bundle":
@@ -1708,12 +1712,13 @@ def import_bundle(
17081712
if "x_opencti_event_version" in stix_bundle
17091713
else None
17101714
)
1715+
if retry_number is not None:
1716+
self.opencti.set_retry_number(retry_number)
17111717
stix2_splitter = OpenCTIStix2Splitter()
17121718
try:
17131719
bundles = stix2_splitter.split_bundle(stix_bundle, False, event_version)
17141720
except RecursionError:
17151721
bundles = [stix_bundle]
1716-
17171722
# Import every elements in a specific order
17181723
imported_elements = []
17191724

0 commit comments

Comments
 (0)