@@ -265,28 +265,23 @@ def contains_stix_entity(self, **kwargs):
265265 "info" ,
266266 "Checking Stix-Entity {" + entity_id + "} in Report {" + id + "}" ,
267267 )
268- query = (
269- """
268+ query = """
270269 query ReportContainsStixDomainEntity($id: String!, $objectId: String!) {
271270 reportContainsStixDomainEntity(id: $id, objectId: $objectId)
272271 }
273272 """
274- )
275273 result = self .opencti .query (query , {"id" : id , "objectId" : entity_id })
276274 if not result ["data" ]["reportContainsStixDomainEntity" ]:
277- query = (
278- """
275+ query = """
279276 query ReportContainsStixRelation($id: String!, $objectId: String!) {
280277 reportContainsStixRelation(id: $id, objectId: $objectId)
281278 }
282279 """
283- )
284280 result = self .opencti .query (query , {"id" : id , "objectId" : entity_id })
285281 return result ["data" ]["reportContainsStixRelation" ]
286282 else :
287283 self .opencti .log (
288- "error" ,
289- "[opencti_report] Missing parameters: id or entity_id" ,
284+ "error" , "[opencti_report] Missing parameters: id or entity_id" ,
290285 )
291286
292287 """
@@ -301,16 +296,20 @@ def contains_stix_observable(self, **kwargs):
301296 if id is not None and stix_observable_id is not None :
302297 self .opencti .log (
303298 "info" ,
304- "Checking Stix-Observable {" + stix_observable_id + "} in Report {" + id + "}" ,
299+ "Checking Stix-Observable {"
300+ + stix_observable_id
301+ + "} in Report {"
302+ + id
303+ + "}" ,
305304 )
306- query = (
307- """
305+ query = """
308306 query ReportContainsStixObservable($id: String!, $objectId: String!) {
309307 reportContainsStixObservable(id: $id, objectId: $objectId)
310308 }
311309 """
310+ result = self .opencti .query (
311+ query , {"id" : id , "objectId" : stix_observable_id }
312312 )
313- result = self .opencti .query (query , {"id" : id , "objectId" : stix_observable_id })
314313 return result ["data" ]["reportContainsStixObservable" ]
315314 else :
316315 self .opencti .log (
@@ -557,7 +556,9 @@ def add_stix_observable(self, **kwargs):
557556 stix_observable_id = kwargs .get ("stix_observable_id" , None )
558557 if id is not None and stix_observable_id is not None :
559558 if report is None :
560- return self .contains_stix_observable (id = id , stix_observable_id = stix_observable_id )
559+ return self .contains_stix_observable (
560+ id = id , stix_observable_id = stix_observable_id
561+ )
561562 if report is None :
562563 self .opencti .log (
563564 "error" , "[opencti_report] Cannot add Object Ref, report not found"
0 commit comments