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

Commit a1a4ece

Browse files
[connectors] Adapt linter + more fixes and take care of sightings
1 parent 040f761 commit a1a4ece

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pycti/entities/opencti_grouping.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,15 @@ def __init__(self, opencti):
396396
"""
397397

398398
@staticmethod
399-
def generate_id(name, context, created):
399+
def generate_id(name, context, created = None):
400400
name = name.lower().strip()
401401
context = context.lower().strip()
402402
if isinstance(created, datetime.datetime):
403403
created = created.isoformat()
404-
data = {"name": name, "context": context, "created": created}
404+
if created is None:
405+
data = {"name": name, "context": context}
406+
else:
407+
data = {"name": name, "context": context, "created": created}
405408
data = canonicalize(data, utf8=False)
406409
id = str(uuid.uuid5(uuid.UUID("00abedb4-aa42-466c-9c01-fed23315a9b7"), data))
407410
return "grouping--" + id

pycti/utils/opencti_stix2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2427,7 +2427,7 @@ def import_item(
24272427
# region Resolve the to
24282428
to_ids = []
24292429
if "x_opencti_where_sighted_refs" in item:
2430-
for where_sighted_ref in item["_opencti_where_sighted_refs"]:
2430+
for where_sighted_ref in item["x_opencti_where_sighted_refs"]:
24312431
to_ids.append(where_sighted_ref)
24322432
elif "where_sighted_refs" in item:
24332433
for where_sighted_ref in item["where_sighted_refs"]:

0 commit comments

Comments
 (0)