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

Commit 09a860d

Browse files
committed
[client] Enhance the generate bundle function to be used everywhere
1 parent 13861b4 commit 09a860d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pycti/connector/opencti_connector_helper.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from typing import Callable, Dict, List, Optional, Union
1919

2020
import pika
21+
import stix2.utils
2122
from filigran_sseclient import SSEClient
2223
from pika.adapters.asyncio_connection import AsyncioConnection
2324
from pika.exceptions import NackError, UnroutableError
@@ -1221,6 +1222,11 @@ def stix2_create_bundle(items) -> Optional[str]:
12211222
:rtype:
12221223
"""
12231224

1225+
# Check if item are native STIX 2 lib
1226+
for i in range(len(items)):
1227+
if hasattr(items[i], "serialize"):
1228+
items[i] = json.loads(items[i].serialize())
1229+
12241230
bundle = {
12251231
"type": "bundle",
12261232
"id": f"bundle--{uuid.uuid4()}",

0 commit comments

Comments
 (0)