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

Commit 61877f2

Browse files
committed
[client] Add a method to get current stream info (#340)
1 parent 9f03745 commit 61877f2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pycti/connector/opencti_connector_helper.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,26 @@ def stop(self) -> None:
640640
def get_name(self) -> Optional[Union[bool, int, str]]:
641641
return self.connect_name
642642

643+
def get_stream_name(self):
644+
if self.connect_live_stream_id is not None:
645+
if self.connect_live_stream_id in ["live", "raw"]:
646+
return self.connect_live_stream_id
647+
else:
648+
query = """
649+
query StreamCollection($id: String!) {
650+
streamCollection(id: $id) {
651+
name
652+
description
653+
stream_live
654+
stream_public
655+
}
656+
}
657+
"""
658+
result = self.api.query(query, {"id": self.connect_live_stream_id})
659+
return result["data"]["streamCollection"]
660+
else:
661+
raise ValueError("This connector is not connected to any stream")
662+
643663
def get_only_contextual(self) -> Optional[Union[bool, int, str]]:
644664
return self.connect_only_contextual
645665

0 commit comments

Comments
 (0)